• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Why I can't retrieve records stored in a XMLFile correctly?

 
Mellihoney Michael
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why I can't retrieve records stored in a XMLFile correctly?
ReadXMLFile.java

the xml file is:
address.xml

the output:

----------------------------------------------------------------------
But the output is supposed to be

can anyone help to explain me?
[ January 14, 2004: Message edited by: Mellihoney Michael ]
 
Ray Stojonic
Ranch Hand
Posts: 326
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The #text tags are the closing tags of your nodes.
If you want to work with XML, I'd recommend learning to use SAX and JDOM.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13064
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are seeing a lot of text nodes that contain the crlf and spaces of your formatted XML. Rather than index through the child nodes, consider use of the getElementsByTagName method to go directly to the Elements you want.
Bill
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am going to move this thread to the XML forum. This forum is for Servlet questions.
Thanks
Mark
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic