Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Parsing XML (using the jakarta commons digester)

 
Katrina Owen
Sheriff
Posts: 1367
18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic