[jdom-interest] (no subject)

Robertson, Jason Jason.Robertson at acs-inc.com
Fri May 30 14:49:49 PDT 2003


To me the overall issue is ease of use in the simple case. I understand your
point about not trusting the structure of a document, especially when a 3rd
party is involved, but I have many cases where the XML is internal only and
I do have absolute control of the format and DTD/Schema availability and I
prefer the ease of use JDOM gives me.

I like the fact that the spirit of the "original" getChild is being kept in
getChildElement, and my issue would totally go away if there were a
getParentElement. This would allow JDOM to adopt the Parent/Child interfaces
and have a more powerful and correct interface, yet still keep the simple
interface around for the simple cases.

The whole casting thing just reminds me of dealing with DOM (which I haven't
done in years, so this is from memory) where you have to cast everything
before you do anything. Wasn't the original vision of JDOM to be a simpler,
more straight-forward DOM? 

<cue-patriotic-music> 
I remember back in the good ol' days and seeing Jason and Brett give a talk
about how they were both walking down the street and bumped into each other
and one got his chocolate in the other's peanut butter, and the other's
peanut butter got in the one's chocolate, or something like that, and this
new thing called JDOM was born.
</cue-patriotic-music>

Ok, sorry, long week.

Anyways, point being I'm not opposed to making the interface "right" and
more powerful, but I'd hate to see the simple interface go away.

Jason

-----Original Message-----
From: Bradley S. Huffman [mailto:hip at a.cs.okstate.edu]
Sent: Friday, May 30, 2003 3:31 PM
To: Vadim.Strizhevsky at morganstanley.com
Cc: jdom-interest at jdom.org
Subject: Re: [jdom-interest] (no subject) 


Is it the interfaces that are the problem, or the fact that getParent,
instead
of always returning a Element, now returns a Parent node which could be
either
a Document or Element?

The interfaces just define the relationships among the various JDOM objects.
Do they now offer much, other than documentation, over b9 or the previous
API?
No.  Will they in the future? I'd say yes, especially when generics make
their
way into java.  Are there other methods that should/could go in them?
Probably.

The real issue seems to be the change in behaviour of getParent, and the
name changes to getChildElement/getChildElements that break existing
code.

More specifically the issue seems to be down casting, and whether or not you
should have to down cast to move up the tree. I don't think it's that big of
deal. And if your worried about performance, I can argue it actually
improves
things in a more common use case, adding content.  With the old behaviour of
getDocument/getParent we had to make 2 calls to determine if a object was
attached, now it's just one, and this affects every document build.

Eliminating as much casting as possible is good to a point.  But by many
people's standards the JDOM API is already to big as it is, so adding
methods
to avoid a instanceof and a cast is not worth it in my book.

Brad
_______________________________________________
To control your jdom-interest membership:
http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhos
t.com



More information about the jdom-interest mailing list