permaculture playing cards
The moose likes Java in General and the fly likes Parsing XML (using the jakarta commons digester) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Parsing XML (using the jakarta commons digester)" Watch "Parsing XML (using the jakarta commons digester)" New topic

Parsing XML (using the jakarta commons digester)

Katrina Owen

Joined: Nov 03, 2006
Posts: 1367
I've run into a snag with a file I am trying to parse.
The file has approximately 700 entries, most of which have the following structure:

Sometimes there will be multiple sections for a single root element, but overall, it follows that basic structure.

There is a small subset of these, approximately 30, that have an extra layer, like so:

For what I'm doing, I don't really need the distinguishing feature, I just want to get to the stuff it wraps.
Would it be completely off the mark to define an additional structure

in addition to the structure that is already defined,

and which works for most of the cases?

Or do I need to approach this in a conceptually different manner?
Ben Souther

Joined: Dec 11, 2004
Posts: 13410

Every time I've used that parser, I've made the Java Object model match the structure of the XML document.

I'm not sure what the easiest way to skip a level would be.

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
I agree. Here's the link:
subject: Parsing XML (using the jakarta commons digester)
It's not a secret anymore!