A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Java in General
Parsing XML (using the jakarta commons digester)
Joined: Nov 03, 2006
Sep 18, 2007 01:14:00
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:
<root> <attribute></attribute> ... <section> <score></score> ... </section> ... </root>
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:
<root> <attribute></attribute> ... <distinguishingFeature> <section> <score></score> ... </section> ... </distinguishingFeature> ... </root>
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?
Joined: Dec 11, 2004
Sep 18, 2007 04:13:00
Every time I've used that parser, I've made the
Object model match the structure of the XML document.
I'm not sure what the easiest way to skip a level would be.
How to ask a question...
Simple Servlet Examples
I agree. Here's the link:
subject: Parsing XML (using the jakarta commons digester)
how to retrieve attribute value of a node
converting a nodelist to a string
Database connectivity - Jboss server
jakarta-tomcat-4.0.1 taglib problem
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015