Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

dom4j does not read closing tag.

 
K Aditi
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can any one please tell me how to read closing tag using dom4j?
e.g. </batch>
I tried to read it using element.getQualifiedName(), but dom4j skips everything after slash(/).

Thanks,
 
Paul Clapham
Sheriff
Posts: 21129
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's not how DOMs work. They don't deal with tags, they deal with elements. So when you have something like

you have a "batch" element which has two "entry" elements as its children. Each of those "entry" elements has a text node as its only child.

If you're trying to deal with tags then a SAX parser might be a slightly better choice. But you shouldn't be trying to deal with tags anyway, because XML itself is described in terms of elements.
 
K Aditi
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok. Will try to implement the code using SAX parser.
Thanks,
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic