problem getting a piece of data out of XML
I have a very simple XML file - just a few lines and each line is a unique piece of data meaning no multiple addresses / names and so on -
I think in XML terms - no children
What I'm trying to do (as a learning deal) is (if I have my vocabulary correct) - parse the file and then pull out some data and print the data.
I assume this is not too complicated.
Before the code I have a Document doc = db.parse(file location)
Nodelist nodelst = doc.getElementByTagName("sample");
Here is the line I think is my working line:
When I open the file the data is there but the above code is not displaying the piece of data beside the tag.
NodeList sampledata = doc.getElementsByTagName("sample");
System.out.println("Data = " + sampledata);
Can you show me a little on dealing with a simple XML file?
What simple method can I acquire and display one piece of data within a parsed XML document?
Thanks for the help