I am parsing a xml file using Axiom parser. If a xml element contains any html entity, axiom parser adds it at the beginning irrespective of its postion.
For Ex:.
<Root>
<P> This element contains α html entity. </P>
</Root>
OMXMLParserWrapperObj.getDocumentElement() returns the following output.
<Root>
<P>α This element contains html entity. </P>
</Root>
But output should be same as the input. Any inputs on how to solve this one ?
I am using the below code:
try {
InputStream in;
OMElement rootOMElement;
in = new FileInputStream(xmlFile);
XMLStreamReader parser;
StAXParserConfiguration standalone = StAXParserConfiguration.STANDALONE;
parser = StAXUtils.createXMLStreamReader(standalone, in);
OMXMLParserWrapper createStAXOMBuilder = OMXMLBuilderFactory.createStAXOMBuilder(parser);
rootOMElement = createStAXOMBuilder.getDocumentElement();
in.close();
}
catch (XMLStreamException | IOException e) {
Logger.getAnonymousLogger().log(Level.SEVERE, e.getStackTrace(), e);
}