You will have to remove and set the namespace for each node in the tree. This is a limitation/functionality of all of the XML Object Models at the moment.
I agree that this is not 'intuitive' and not in line with how you specify a namespace in a XML document, where the namespace gets inherited by default. Kind regards, Edwin Dankert 2009/11/14 Yevgeniy Belman <ysbel...@gmail.com>: > found this post. It definitely works, but is this the desired approach? > http://www.mail-archive.com/dom4j-user@lists.sourceforge.net/msg01591.html > > > > On Fri, Nov 13, 2009 at 4:41 PM, Yevgeniy Belman <ysbel...@gmail.com> wrote: >> >> Hi, I'm using dom4j to parse and map xml docs and could really use some >> help with 1.6.1 library. When i do an Element.remove(Namespace), the >> namespace does not get removed. Here's a snippet where i am trying to remove >> xmlns from the NbOfTxnPerSts element. It is not working for me. Any ideas? >> >> Element stat... >> Element pain997... >> >> stat.detach(); >> stat.remove(stat.getNamespace()); >> System.out.println(stat.asXML()); >> pain997.add(stat); >> >> <NbOfTxsPerSts xmlns="urn:iso:std:iso:20022:tech:xsd:pain.001.001.02"> >> <DtldNbOfTxs>1</DtldNbOfTxs> >> <DtldSts>ACTC</DtldSts> >> </NbOfTxsPerSts> > > > ------------------------------------------------------------------------------ > Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day > trial. Simplify your report design, integration and deployment - and focus > on > what you do best, core application coding. Discover what's new with > Crystal Reports now. http://p.sf.net/sfu/bobj-july > _______________________________________________ > dom4j-user mailing list > dom4j-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/dom4j-user > > ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ dom4j-user mailing list dom4j-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/dom4j-user