I have an XML file starting:
<?xml version="1.0"?>
<results>
<result id="0001">
<hometeam>
<name>Dantooine Destroyers</name>
<score>6</score>
</hometeam>
<awayteam>
<name>Wayland Warriors</name>
<score>0</score>
</awayteam>
</result>
<result id="0002">
<hometeam>
<name>Dantooine Destroyers</name>
<score>3</score>
</hometeam>
<awayteam>...
and in a java file:
if(event.isStartElement()){
if(event.asStartElement().getName().getLocalPart().equals(HOME)){
System.out.println("In hometeam"); // for testing purposes
event = eventReader.nextEvent(); // I expect <name> element
if(event.isStartElement()){ // <------------ FALSE
if(event.asStartElement().getName().getLocalPart().equals(NAME)){....
I'd expect this if statement to be true for the <name> element but if I stick in a System.out.println(event.isStartElement()) I get FALSE....
Also event.getEventType() returns XMLEvent.CHARACTERS which I don't understand... Can anybody see why?
Feel free to make edits to tags/title and question if necessary.