This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes XML and Related Technologies and the fly likes dom4j does not read closing tag. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "dom4j does not read closing tag." Watch "dom4j does not read closing tag." New topic
Author

dom4j does not read closing tag.

K Aditi
Ranch Hand

Joined: Mar 17, 2008
Posts: 89
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,


Aditi
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

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

Joined: Mar 17, 2008
Posts: 89
Ok. Will try to implement the code using SAX parser.
Thanks,
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: dom4j does not read closing tag.