I'm working with the XMLStreamReader and parsing the following XML:
<root>
<element>
<attribute>level0</attribute>
<element>
<attribute>level1</attribute>
<element>
<attribute>level2</attribute>
</element>
</element>
</element>
</root>
I'm building out my XMLStreamReader:
XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(
new ByteArrayInputStream(document.getBytes()));
Unfortunately, when I get to the first closing element tag with reader.next();
, I get the following exception:
javax.xml.stream.XMLStreamException: ParseError at [row,col]:[7,14]
Message: XML document structures must start and end within the same entity.
Is there a way to override the default behavior of the XMLStreamReader to get around with this?
Aucun commentaire:
Enregistrer un commentaire