You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ws.apache.org by "Andreas Veithen (Jira)" <ji...@apache.org> on 2021/11/13 14:27:00 UTC
[jira] [Assigned] (AXIOM-509) Reading and writing a file with & outputs &
[ https://issues.apache.org/jira/browse/AXIOM-509?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Andreas Veithen reassigned AXIOM-509:
-------------------------------------
Assignee: Andreas Veithen
> 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
>
> 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-unsubscribe@ws.apache.org
For additional commands, e-mail: dev-help@ws.apache.org