Details
-
Bug
-
Status: Resolved
-
Blocker
-
Resolution: Fixed
-
1.3.0
-
None
-
Important
Description
On some documents when an element contains a mixture of elements and 2 or more text nodes and one of those text nodes contains an & then when the document is written out it writes out & instead of &. This causes the document to be invalid when it is read in the next time because & should be & in XML. Take this simple case (notice there is a space after the entry element):
<entry> <ref:pagenum="4469"/> SUBTOTAL SYSTEM DEVELOPMENT & DEMONSTRATION </entry>
This is valid XML but when it is written back out it is:
<entry> <ref:pagenum="4469"/> SUBTOTAL SYSTEM DEVELOPMENT & DEMONSTRATION </entry>
This is not valid XML and will cause the document to fail when it is read in the next time. I have not found a way to work around this yet.
To read the document in
XMLInputFactory xmlFactory = XMLInputFactory.newInstance();
xmlFactory.setProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, false);
xmlFactory.setProperty(XMLInputFactory.SUPPORT_DTD, false);
xmlFactory.setProperty(XMLInputFactory.IS_REPLACING_ENTITY_REFERENCES, false);
xmlFactory.setProperty(XMLInputFactory.IS_COALESCING, true);
XMLStreamReader xmlStreamReader = xmlFactory.createXMLStreamReader(inputStream, encodingFormat);
OMXMLParserWrapper staxOMBuilder = OMXMLBuilderFactory.createStAXOMBuilder(xmlStreamReader);
omDocument = staxOMBuilder.getDocument();
Attachments
Issue Links
- is duplicated by
-
AXIOM-514 < issue in AXIOM parser
- Resolved