Print XML tag
I have written some java code to Parse an XML file.
It is almost exactly the same as the code here:
A Simple Way to Read an XML File in Java - Print Version
Basically, I have it returning the XML values but what I want to be able to do now is to return the actual tag.
So if we have:
I have the code which will return: 22
Now I need the code to show the actual TAG: <age>
Does anyone know how this can be done????
Assumes this is printing the age Change like this
System.out.println("Age : " + ((Node)textAgeList.item(0)).getNodeValue().trim());
XMLString() will return an xmlstring just remove the "<?xml version="1.0"?>" so we added the substring function
System.out.println("Age : " + ((Node)textAgeList.item(0)).asXMLString().subString(55));
Thanks for the quick reply.
.asXMLString() doesn't seem to be recognized? Any ideas?