Re: Resetting the Root Element

"Grzegorz Kaczor" <[email protected]>
Newsgroups gmane.comp.java.jdom.general
Message-ID <[email protected]>
Hi,

you can create a new document and add to it contents of the root element.

Element root = new Element("new_root");
root.addContent(oldRoot.removeContent());

or something similar (I am writing from memory).

Regards,
Grzegorz

2007/11/5, Sebastian Hinterwälder <[email protected]>:
>
> Hello,
>
> I have a question concerning the root element of a normal XML document.
> Probably something like this already appeared in this list some time
> ago, but I don't get my problem solved so far.
>
> I have a normal "ATOM feed" which looks something like this:
>
> <?xml version="1.0" encoding="utf-8"?>
> <!-- generator="FeedCreator 1.6" -->
> <feed xmlns="http://www.w3.org/2005/Atom"
> xmlns:dc="http://purl.org/dc/elements/1.1/"
> xml:lang="de">
>     <title>Golem.de</title>
>     <subtitle>IT-News fuer Profis</subtitle>
>     ....
>
> Now I want to set a different root element using JDOM. I already tried
> it by cloning the whole document but this doesn't work. A different
> solution for me would also be removing the namespaces from the root. I
> am quite new to JDOM - so I hope someone knows a solution!
>
> Thanks in advance
>
> Sebastian
> _______________________________________________
> To control your jdom-interest membership:
> http://www.jdom.org/mailman/options/jdom-interest/[email protected]
>



-- 
"Choć tyle wiemy własnym doświadczeniem:
W nas jest Raj, Piekło - i do obu - szlaki."
J.K.

_______________________________________________
To control your jdom-interest membership:
http://www.jdom.org/mailman/options/jdom-interest/[email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.