[jdom-interest] Help with org.jdom.Element.removeNamespaceDeclaration

Shawn Bellina sbellina at earthlink.net
Tue Mar 26 12:44:35 PST 2002

 I need some help understanding removeNamespaceDeclaration - the snippet
below shows an attempt to remove the namesapce from the root.  I also tried
moving to another element with out any luck.  Can someone please point me in
the rite direction?

		_thanks shawn

 * RemoveNamespaceDeclarationTest.java
 * trying to figure out how to remove a namespace from adocument?

import java.io.FileInputStream;

import org.jdom.input.SAXBuilder;
import org.jdom.Document;
import org.jdom.Element;
import org.jdom.Namespace;

public class RemoveNamespaceDeclarationTest {

    public static void main (String args[]) {
        RemoveNamespaceDeclarationTest test = new


    public Document buildDocument(String path){
        // parse the in file
        Document doc = null;
            SAXBuilder builder = new SAXBuilder();
            doc = builder.build(new FileInputStream(path));
        }catch(Exception e){
    return doc;
    public Document removeNamespace(Document doc){
        // remove the namespace on the root of the document
        Element e = doc.getRootElement();
        String s = e.getNamespaceURI();

        System.out.println("before: " + e.getNamespace());


        System.out.println("after: " + e.getNamespace());

    return doc;



T h e   S a l i e n t    G r o u p
shawn bellina, CTO
[e-mail].. shawnbellina at earthlink.net
[IM]....... shawnbellina at jabber.com
............. shawnbellina at yahoo.com
............. shawnbellina at alo.com
............. shawnbellina at hotmail.com
[cell]..... 404.434.5516

-------------- next part --------------
A non-text attachment was scrubbed...
Name: RemoveNamespaceDeclarationTest.java
Type: application/octet-stream
Size: 1462 bytes
Desc: not available
Url : http://jdom.org/pipermail/jdom-interest/attachments/20020326/64ae66e2/RemoveNamespaceDeclarationTest.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.xml
Type: text/xml
Size: 1948 bytes
Desc: not available
Url : http://jdom.org/pipermail/jdom-interest/attachments/20020326/64ae66e2/test.xml

More information about the jdom-interest mailing list