[jdom-interest] Still Can't Kill Namespace

T.B. Pogie pogietb at netscape.net
Wed Jun 19 08:02:48 PDT 2002

I'm unable to remove a namespace in 0.8 that I could remove in 0.7. Using a DefaultJDOMFactory subclass (CustomJDOMFactory) and an Element subclass (CleanElement) I only pass the local name to the Element constructor - no namespace, prefix or uri. Everything worked fine in 0.7 but now when I write the resulting document back out, the namespace reappears. I've narrowed down the problem, I think, to the XMLOutputter but I'm stuck. Maybe the NamespaceStack is the culprit? 

       SAXBuilder sb = new SAXBuilder();
       JDOMFactory factory = new CustomJDOMFactory();
       Document xmlDoc = sb.build(xmlFile);

       System.out.println("root is " + xmlDoc.getRootElement().getClass.getName());
       System.out.println("root name is " + xmlDoc.getRootElement().getName());
       System.out.println("root ns is " + xmlDoc.getRootElement().getNamespace().toString());

       XMLOutputter out = new XMLOutputter();

       The command line output is:

       root is CleanElement
       root name is document
       root ns is [Namespace:prefix "" is mapped to URI ""]

       <document xmlns:"http://www.lotus.com/dxl" >
              <item xmlns:" ">

Any suggestions on why it worked in 0.7 but not 0.8 and what I can do about it?  I'm parsing some big files and need the performance enhancements of 8 so I'm reluctant to just go back to 7.
TB Pogie

Your favorite stores, helpful shopping tools and great gift ideas. Experience the convenience of buying online with Shop at Netscape! http://shopnow.netscape.com/

Get your own FREE, personal Netscape Mail account today at http://webmail.netscape.com/

More information about the jdom-interest mailing list