FasterXML/aalto-xml

XML Escape is not working

agwermann opened this issue · 1 comments

Hi all,

We are not able to escape some characters when using aalto-xml. It looks the characters < and ' are not being escaped.

Method called: writer.writeCharacters("<>'&");
Input: <>'&
File result: &lt;>'&amp;

Our current implementation uses XMLStreamWriter and ByteXmlWriter. When debugging the code, it looks the issue happens in writeCharacters method.

Can you please assist on this issue?

Regards,
Alexandre

I assume you mean > (not <) and apostrophe are not being escaped.
If so, that is perfectly fine: > is optional to escape (with sole exception of sequence of ]] followed by > requiring escape), and apostrophe only has to be escaped if within attribute value that uses apostrophe as quote.

There is no way to currently change escape settings; if that is needed, you may want to look into Woodstox which offers extensive configurability, and I think includes functionality to force escaping of these 2 characters too.,