[jdom-interest] (no subject)
Robertson, Jason
Jason.Robertson at acs-inc.com
Thu May 29 08:17:36 PDT 2003
So, just wondering, why doesn't Parent have a getParent() method?
It seems like this would be reasonable given XML's hierarchical layout, i.e.
if you have a parent it's only one parent so getParent() would be
unambiguous. Comparatively it doesn't make sense for Child to have something
like getChild() since going down the tree is much more complex.
In this one tool I've written I have quite a few places where I do, for
example
getParent().getParent().getParent().getAttribute()
and of course I could replace it with XPath, or this:
((Element) ((Child) ((Child)
getParent()).getParent()).getParent()).getAttribute()
but this looks kinda funny and it just feels like you should be able to
string getParent() calls together directly. I guess you'll still have to
cast an Element in the end, but one cast is better than several.
Jason
p.s. I have approx 1 month of jdom-interest locally, and I searched that but
didn't find anything. If this has been previously discussed let me know and
I'll hit the archives.
-----Original Message-----
From: Bradley S. Huffman [mailto:hip at a.cs.okstate.edu]
Sent: Tuesday, May 27, 2003 4:47 PM
To: bob mcwhirter
Cc: jdom-interest at jdom.org
Subject: Re: [jdom-interest] (no subject)
At one time I think I had a patch to jaxen that took care of this. I'll
look for it when I get home, make sure it still works, and send it in for
jdom-contrib.
Brad
bob mcwhirter writes:
>
> Yah, fwiw, this broke jaxen and jxpath and their support of JDOM,
> according to gump. I haven't gotten jaxen fixed yet.
>
> -bob
>
>
> On Tue, 27 May 2003, Jason Hunter wrote:
>
> > > elementMatched(String path, Element e) {
> > > String parentName =
e.getParent().getParent().getAttributeValue("name")
> ;
> > > }
> > >
> > > This no longer works because getParent() returns a Parent instead of
an
> > > Element. Is there a way around this?
> >
> > Cast it?
> >
> > -jh-
> >
> >
> > _______________________________________________
> > To control your jdom-interest membership:
> >
http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourho
> st.com
> >
>
> --
> Bob McWhirter bob at werken.com
> The Werken Company http://werken.com/
>
> _______________________________________________
> To control your jdom-interest membership:
>
http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhos
t
> .com
_______________________________________________
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