[jdom-interest] Re: short question

Todd O'Bryan toddobryan at mac.com
Mon Aug 6 18:19:14 PDT 2001


I realized I had sent this reply directly to vincent, but hadn't sent a 
copy to the list, so I'm sending one now so it makes it into the archive.

Todd

> From: Todd O'Bryan <toddobryan at mac.com>
> Date: Mon Aug 06, 2001  10:35:11 AM US/Pacific
> To: "vincent leycuras" <lv68 at hotmail.com>
> Subject: Re: [jdom-interest] (no subject)
>
> Right now, your document doesn't have a root element. Wrap everything 
> in something like a <document> tag (you could write a Reader class that 
> would append this before and after the file if you don't want to change 
> the file) and then do something like:
>
> List parents = doc.getRootElement().getChildren("parent");
>
> and you'll have a List with all the parent elements. parents.get(0) 
> gives you the first, parents.get(1) gives you the second, etc.
>
> Hope that helps,
> Todd
>
> On Monday, August 6, 2001, at 04:52 PM, 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 at yourhost.com
>



More information about the jdom-interest mailing list