[jdom-interest] how to find a node with maxest attribute in xml file use xpath?
Philip Nelson
panmanphil at yahoo.com
Thu Nov 14 06:28:17 PST 2002
Correct. (from memory) There is some example code, possibly in jdom-contrib,
possibly in the list archives showing how to use the Comparable interface to
sort. So given that you can get a List of elements, you can use the standard
java techniques to sort a List with a Comparable.
The orgiginal question was on how to use XPath though. Not being an xpath
wizard, is there an xpath Max function? If so then it seems like a fairly
simple jaxen call to find the max id.
--- "John L. Webber - Jentro AG" <John.Webber at jentro.com> wrote:
> This is really a Java problem, not a JDOM problem. There are a number of
> approaches that could work. You basically need to go through all the AAA
> elements and parse the values of the id attributes. org.jdom.Attribute
> has a utility method, getIntValue() that might help.
>
> John
>
>
>
> glliu wrote:
> > Hi,
> > I use jdom to reading and writing to XML files.and I need help on
> > the following problem. Any suggestions?
> >
> > Thanks in Advance.
> > glliu
> >
> >
> > xml files:
> >
> > <A>
> > <AAA id="001">
> > <AAA id="004">
> > <AAA id="023">
> > <AAA id="098">
> > <AAA id="002">
> > <A>
> >
> > how can I find the node with maxest id attribute?here is <AAA id="098">.
>
> --
> ---------------------------------------------------------
> Jentro AG
> John L. Webber, Software Development
> ---------------------------------------------------------
> Peter-Henlein-Strasse 28, 85540 Haar/Munich, Germany
> Tel. +49 89 462 385 0 mailto:John.Webber at jentro.com
> Fax +49 89 462 385 29 http://www.jentro.com
> ---------------------------------------------------------
> { smart networks - connect your world }
> ---------------------------------------------------------
>
> _______________________________________________
> To control your jdom-interest membership:
>
http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com
__________________________________________________
Do you Yahoo!?
Yahoo! Web Hosting - Let the expert host your site
http://webhosting.yahoo.com
More information about the jdom-interest
mailing list