Hi
I am writing a code using stax parser. But recently I got an error when "&" or "&" present in the xml document.
This is the error I am getting
javax.xml.stream.XMLStreamException: ParseError at [row,col]:[30,30]
Message: The reference to entity "name" must end with the ';' delimiter.
This is my xml
<url> http://url?id=1&name=aaa </url>
This is my code
XMLInputFactory xmlInputFactory = XMLInputFactory.newInstance();
xmlInputFactory.setProperty(
XMLInputFactory.IS_REPLACING_ENTITY_REFERENCES,
Boolean.TRUE);
xmlInputFactory.setProperty(
XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES,
Boolean.FALSE);
xmlInputFactory.setProperty(XMLInputFactory.IS_COALESCING, Boolean.FALSE);
String xmlSource;
XMLStreamReader reader = xmlInputFactory.createXMLStreamReader(new ByteArrayInputStream(xmlSource.getBytes("UTF-8")));
while (reader.hasNext())
{
....
reader.next(); // error throws in this line
}
Can someone please help me.