[jdom-interest] Resetting the Root Element

Grzegorz Kaczor grzegorz.kaczor at gmail.com
Tue Nov 6 01:13:02 PST 2007


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 <hintsn at idmt.fraunhofer.de>:
>
> 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/youraddr@yourhost.com
>



-- 
"Choć tyle wiemy własnym doświadczeniem:
W nas jest Raj, Piekło - i do obu - szlaki."
J.K.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.jdom.org/pipermail/jdom-interest/attachments/20071106/ff530b46/attachment.htm


More information about the jdom-interest mailing list