Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
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 Android Security Essentials Live Lessons this week in the Android 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,
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: dom4j does not read closing tag.
 
Similar Threads
Invocation of init method failed; exception is org.hibernate.InvalidMappingException
UPS Online Tools
jsp:getProperty
why is there a "?" in the beginning of an xml document
problem Div tag with If()