  | Mailing List | | Home | | Forum Home | | JBoss - Java Application Server | | Tomcat - JSP/Servlet container | | Struts - A MVC web framework | | iText - An open source PDF Java Library | | JDOM - JDOM XML Parser | | JSP - A mailing list about Java Server Pages specification and reference | | J2EE - A mailing list for Java(tm) 2 Platform, Enterprise Edition | | J2EE Pattern - An interest list for Sun Java Center J2EE Pattern Catalog | | Servlet - A mailing list for discussion about Sun Microsystem's Java Servlet API Technology | |
Struts & Hibernate
|
|
|
  | | | Subject: Re: Resetting the Root Element | Subject: Re: Resetting the Root Element 2007-11-06 - By Grzegorz Kaczor
Back 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@(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 (See http://utf-8.ora-code.com)"?> > <!-- 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@(protected) >
-- "Cho? tyle wiemy w?asnym do?wiadczeniem: W nas jest Raj, Piek?o - i do obu - szlaki." J.K.
Hi,<br><br>you can create a new document and add to it contents of the root element. <br><br>Element root = new Element("new_root");<br>root .addContent(oldRoot.removeContent());<br><br>or something similar (I am writing from memory). <br><br>Regards,<br>Grzegorz<br><br><div><span class="gmail_quote">2007/11/5, Sebastian Hinterw?lder <<a href="mailto:hintsn@(protected)">hintsn @(protected)</a>>:</span><blockquote class="gmail_quote" style="border -left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"> Hello,<br><br>I have a question concerning the root element of a normal XML document.<br>Probably something like this already appeared in this list some time<br>ago, but I don't get my problem solved so far.<br><br>I have a normal "ATOM feed" which looks something like this: <br><br><?xml version="1.0" encoding="utf-8 (See http://utf-8.ora-code.com)"?><br>< ;!-- generator="FeedCreator 1.6" --><br><feed xmlns="<a href="http://www.w3.org/2005/Atom">http://www.w3.org/2005/Atom</a> "<br> xmlns:dc="<a href="http://purl.org/dc/elements/1.1/">http:/ /purl.org/dc/elements/1.1/</a>"<br> xml:lang="de"><br> <title><a href="http://Golem.de">Golem.de</a></title ><br> <subtitle>IT-News fuer Profis</subtitle > <br> ....<br><br>Now I want to set a different root element using JDOM. I already tried<br>it by cloning the whole document but this doesn't work. A different<br>solution for me would also be removing the namespaces from the root. I <br>am quite new to JDOM - so I hope someone knows a solution!<br><br>Thanks in advance<br><br>Sebastian<br>__ ____ ____ ____ ____ ____ ____ ____ ____ ____<br >To control your jdom-interest membership:<br><a href="http://www.jdom.org /mailman/options/jdom-interest/youraddr@(protected)"> http://www.jdom.org/mailman/options/jdom-interest/youraddr@(protected)</a><br> </blockquote></div><br><br clear="all"><br>-- <br>"Cho? tyle wiemy w?asnym do?wiadczeniem:<br>W nas jest Raj, Piek?o - i do obu - szlaki." <br>J.K.
__ ____ ____ ____ ____ ____ ____ ____ ____ ____ To control your jdom-interest membership: http://www.jdom.org/mailman/options/jdom-interest/youraddr@(protected)
|
|
 |