Closed gkovacs20-cxn closed 1 month ago
Yes? ">" need not be escaped; not mandated by XML specification, with a single exception (I think as part of "]]>"). Some libraries just escape all instance; Woodstox does not. It's not a bug but feature (minimizing escaping).
See f.ex https://stackoverflow.com/questions/1091945/what-characters-do-i-need-to-escape-in-xml-documents
Can this be configured or is this a strict behavior?
This can be configured, although it is not as easy as I'd hope let me see if I can find references....
Ok so
src/test/java/org/codehaus/stax/test/wstream/CharacterEscapingTest.java
has an example using XMLOutputFactory2.P_TEXT_ESCAPER
configuration, where you need to implement EscapingWriterFactory
.
https://stackoverflow.com/questions/2783758/xmlstreamwriter-writecharacters-without-escaping
has some more info; and https://cowtowncoder.medium.com/configuring-woodstox-xml-parser-stax2-properties-c80ef5a32ef1 has full set of configuration settings.
So I hope some of that is helpful.
Thank you for detailed answer!
If the value of an attribute contains
>
, it is not escaped as>
, but rather printed as-is, resulting in an invalid XML.<
is correctly escaped.Tested with 6.6.2.