[jdom-interest] design question using jdom

bob mcwhirter bob at werken.com
Tue Oct 2 19:37:31 PDT 2001


Well, I'd suggest either looking-for, or creating something
that uses the miracles of introspection and xpath to generically
map this stuff from a runtime config file, or something.

Certain paths (ie, '/order/@number') map to certain attributes/methods
(ie, Order.setOrderNumber()).  

Things get more complex dealing with collections, such as elements
matching /order/line-items/line-item.  

Right off hand, I know there are several packages out there to
help you, but I can't remember a single name.  If you want to build
something yourself, java.lang.reflect and http://jaxen.org/ would
be good starting points.

	-bob


On Tue, 2 Oct 2001, Jim Knoll wrote:

> Hi,
> 
> I am totally new to xml and jdom and still trying to grasp object oriented
> design.  The xml document I have created represents a data structure which
> contains references to several other data structures.  I can successfully
> parse the document using JDOM, but I am unsure of the best way to create
> the data structures.  Should I pass each data structure the parent element
> in the constructor and have it construct itself or should I create another
> class that is responsible for constructing the data structure with all of
> its references.
> 
> I don't know if it is better to make each data structure responsible for
> knowing its piece of the xml document, or if that data structure should
> know nothing of xml and rely on another class to create it.  That would
> mean the class creating each of the other data structures has to know
> about the xml document and each of the individual classes it is to create.
> 
> I can provide a sample document if that would help.
> 
> Thanks for any advice you can give me.
> 
> Jim
> 
> _______________________________________________
> To control your jdom-interest membership:
> http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com
> 




More information about the jdom-interest mailing list