How to add two nodes with the same name on the same level?

View: New views
3 Messages — Rating Filter:   Alert me  

How to add two nodes with the same name on the same level?

by junk_mail :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

hi,

Is it possible to add two nodes with the same name on the same level of
xml file using .addcontent() method?

I'm trying to do so and I get following error:

Exception in thread "main" org.jdom.IllegalAddException: The Content
already has an existing parent "tree"...

Is there any way to disable that execption and force jdom to create two
nodes with the same name?

regards,
sly

----------------------------------------------------
Gadają o tym wszędzie!!!
SPRAWDź alefaceci.pl
http://klik.wp.pl/?adr=www.alefaceci.pl&sid=607


_______________________________________________
To control your jdom-interest membership:
http://www.jdom.org/mailman/options/jdom-interest/youraddr@...

Re: How to add two nodes with the same name on the same level?

by polx :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Sly,

you need to duplicate them first.
Element objects correspond to concrete elements in the tree since you  
can get parent or iterate through the list so you really have to make  
two different objects.
Using clone() is an easy way to duplicate. After a case, you can  
addContent again.

paul


Le 14-janv.-09 à 08:31, junk_mail@... a écrit :

> Is it possible to add two nodes with the same name on the same level  
> of
> xml file using .addcontent() method?
>
> I'm trying to do so and I get following error:
>
> Exception in thread "main" org.jdom.IllegalAddException: The Content
> already has an existing parent "tree"...
>
> Is there any way to disable that execption and force jdom to create  
> two
> nodes with the same name?


_______________________________________________
To control your jdom-interest membership:
http://www.jdom.org/mailman/options/jdom-interest/youraddr@...

smime.p7s (2K) Download Attachment

Re: How to add two nodes with the same name on the same level?

by junk_mail :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thank You Paul!!!

regards,
sly

----------------------------------------------------
Czy Piotr Kupicha zadebiutuje na parkiecie?
http://klik.wp.pl/?adr=http%3A%2F%2Fcorto.www.wp.pl%2Fas%2Fs1.html&sid=613


_______________________________________________
To control your jdom-interest membership:
http://www.jdom.org/mailman/options/jdom-interest/youraddr@...