[jdom-interest] short question
Aaron Oathout
aaron at codejunkies.org
Mon Aug 6 10:08:47 PDT 2001
You can call getChildren and cycle through the list working with the
elements.
Example:
Iterator itr = rootElement.getChildren("parent").iterator();
while( itr.hasNext() ) {
Element parent = (Element)itr.next();
System.out.println( parent.getChildText( "child1" ) );
System.out.println( parent.getChildText( "child2" ) );
}
Hope that helps.
Aaron
On Mon, 6 Aug 2001, vincent leycuras wrote:
> Hi all,
>
> I am in the process of writing a small app that retrieves information using
> the following scheme from an XML document:
>
> every identical node (same name, same type) represents a line, and its
> children represent a column. For example:
>
> <parent>
> <child1>blob</child1>
> <child2>blabla</child2>
> </parent>
> <parent>
> <child1>sdf</child1>
> <child2>fdsg</child2>
> </parent>
> ... and so on. Here, I want the result to be:
> Col1 | Col2
> line 1 | blob | blabla
> line 2 | sdf | fdsg
>
> ... But I couldn't find out how to access the second "parent" node.
>
> Any help gladly welcome!
>
> BTW, this package is brilliant ;-P.
>
> Cheers, Vincent.
>
>
>
> _________________________________________________________________
> Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
>
> _______________________________________________
> 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