File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Double xml read

 
Matthew Tilic
Ranch Hand
Posts: 41
Chrome Java MySQL Database
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey,

I have an xml string and am doing a system out to see the results. The only issue use I keep getting duplicate results! why is this





Here is an example of my output:


Element tagname : client
getcharactervalue: website
..................................
Element tagname : client
getcharactervalue: website
..................................
Element tagname : request
getcharactervalue: insert
..................................
Element tagname : request
getcharactervalue: insert
..................................
Element tagname : databaseschema
getcharactervalue: barapplication
..................................
Element tagname : request
getcharactervalue: insert
..................................
Element tagname : table
getcharactervalue: ownerAddress
 
Rob Spoor
Sheriff
Pie
Posts: 20372
44
Chrome Eclipse IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Move lines 13-15 to before the loop; they are called for the node itself, not the child nodes.
Be warned though that the cast to Element may fail; whitespace like line breaks are often seen as Text nodes, and will show up in the child node list.
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic