[ https://issues.apache.org/jira/browse/AXIOM-509?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Andreas Veithen resolved AXIOM-509. ----------------------------------- Fix Version/s: 1.3.1 Resolution: Fixed > Reading and writing a file with & outputs & > ----------------------------------------------- > > Key: AXIOM-509 > URL: https://issues.apache.org/jira/browse/AXIOM-509 > Project: Axiom > Issue Type: Bug > Components: LLOM > Affects Versions: 1.3.0 > Reporter: Kyla Miller > Assignee: Andreas Veithen > Priority: Blocker > Fix For: 1.3.1 > > > 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(); > -- This message was sent by Atlassian Jira (v8.20.1#820001) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@ws.apache.org For additional commands, e-mail: dev-h...@ws.apache.org