[jdom-interest] Child number

Todd O'Bryan toddobryan at mac.com
Tue Apr 16 16:51:40 PDT 2002


I'm not 100% sure that this will work, but it seems like it should. 
Someone yell at me if it doesn't...

If you have the Element handy, you should just be able to call its 
detach() method. So if you have
something like

Element e;
if (e.getChildText().equals("B")) {
	e.detach();
}

that should work.

Todd

On Tuesday, April 16, 2002, at 04:16  PM, bob mcwhirter wrote:

>
> Presumably you're iterating, looking for 'B' in the first place,
> so check the mail archives for discussion regarding ListIterator...
>
> 	-bob
>
> On Tue, 16 Apr 2002, KhanhVinh Tran wrote:
>
>> I have a XML doc as below:
>>
>> <sample>
>>        <child> A </child>
>>        <child> B </child>
>>        <child> C </child>
>>        ...
>> </sample>
>>
>> How do I know "B" is the text of the 2rd child?
>> I need to know the child number so I can use
>> the method remove(int child#).
>> Ex: allChildren.remove(3) //remove the third child
>>
>> Thanks in advance.
>>
>>
>>
>> __________________________________________________
>> Do You Yahoo!?
>> Yahoo! Tax Center - online filing with TurboTax
>> http://taxes.yahoo.com/
>> _______________________________________________
>> To control your jdom-interest membership:
>> http://lists.denveronline.net/mailman/options/jdom-
>> interest/youraddr at yourhost.com
>>
>
> _______________________________________________
> 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