dcsimg
Add a node to an XML with JDOM
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Hugo_Paredes
Posted On:   Friday, May 16, 2008 12:48 PM

Hi to all, I'm trying to add an element to a JDOM document. I have something like this: And I want to add the following element: The result should be something like: But the problem is that JDOM considers the element that I want to add as a new root element. If I try to add a simple element (for example, ) I can, but the element as I want, I can't add it. Anyone knows how to solve this problem? Thank you in advance.    More>>

Hi to all,

I'm trying to add an element to a JDOM document.
I have something like this:

			
















And I want to add the following element:
			








The result should be something like:
			






















But the problem is that JDOM considers the element that I want to add as a new root element. If I try to add a simple element (for example, ) I can, but the element as I want, I can't add it.
Anyone knows how to solve this problem?

Thank you in advance.    <<Less

Re: Add a node to an XML with JDOM

Posted By:   Roseanne_Zhang  
Posted On:   Thursday, June 5, 2008 03:28 PM

Before you add the element, call detach() on that element.


However, since jdom had stoppen developping in 2004, you should consider stop using jdom, use some other xml libraries.


Thanks!

About | Sitemap | Contact