I use stax to write a XML file.
My question is how can I add the attribute xml:space="preserve"
to my elements?
xml
prefix? AFAIK, it is normally not necessay.
null
( javax.xml.stream.XMLStreamException: Prefix cannot be null)setPrefix("xml", "http://www.w3.org/1998/xml")
on my XMLStreamWriter
, it seems to have no effect. In debug mode, I see that the nsmap of the XMLStreamWriter has no entry for "xml"writeAttribe("http://www.w3.org/1998/xml", "space", "preserve")
. Is there a specific method for this instead?I found a work around:
writeAttribute("xml:space", "preserve")
but this is a non-sense because xml:space
is not a local name, is it?