[jdom-interest] (no subject)

Robertson, Jason Jason.Robertson at acs-inc.com
Thu May 29 17:18:49 PDT 2003


But there is still getChildElement() in Element, and the same argument about
checking for null you give below still holds. What do you see as the
difference?

And as far as checking for null, if my DTD/Schema says that certain elements
are required, then yes I am really, really sure :) that it's going to be
there. Isn't that half the point of validation - so you don't have to do it
in your code? I agree on optional elements/attributes you have to check, but
that's ok since it's optional. 

Getting back to the interfaces, one thing that that confuses me a little bit
is that the Parent interface's method names do not deal in Children - there
is no getChild(), it's getContent(). But the Child interface's method names
do deal with Parents with it's getParent() method. 

And in Element, getChild() returns an Element, but getParent() return a
Parent. Seems inconsistent, but I fully understand this a tough area!

If any of this has changed in CVS, my apologies, I'm looking at the nightly
drop.

Jason

-----Original Message-----
From: Bradley S. Huffman [mailto:hip at a.cs.okstate.edu]
Sent: Thursday, May 29, 2003 12:21 PM
To: Jason Hunter
Cc: jdom-interest at jdom.org
Subject: Re: [jdom-interest] (no subject) 


Jason Hunter writes:

> Hmm, I'm still thinking we need a method like getParentElement(). 
> Returns the parent Element or null if root or unattached.  It could be 
> added to Child.  Then you could call 
> getParentElement().getParentElement()...

Only if your absolutely sure there will always be a non-null object returned
for each call.  "If it cann't be broken, users will find a way to break it".

> Then all b9 getParent() calls can be moved to getParentElement() calls 
> in b10.  I think getParent() has to continue returning a Parent just to 
> be sensible.
> 
> Thoughts?

Then you'd have 3 different methods for moving up the tree getDocument,
getParent, and getParentElement. May as well throw in getRootElement
and getParent(int level) ;-)

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