[jdom-interest] DOMOutputter...

Rafizan Baharum udabahar at umich.edu
Fri Nov 17 14:51:24 PST 2000


hi ..

ive tried running a simple program below on DOMOutputter and compare it
with DOMParser
i noticed that the Document created is losing namespaceURI, localName,
prefix and Doctype
the output ive got is..


------------DOMPARSER INFO--------------
fo:root
root
fo
http://www.w3.org/1999/XSL/Format
[fo:root: null]
-----------DOMOUTPUTTER INFO------------
fo:root
null
null
null
null

am i doing something wrong or is this a possible bug??
btw, im using fresh cvs checkout today 11/17 5:48pm

thanks

.z00t


my xml looks like this
<?xml version="1.0" encoding="utf-8"?>
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
</fo:root>


code..
      DOMParser parser = new DOMParser();
      InputSource input = new InputSource(new FileInputStream(source));
      parser.setFeature("http://xml.org/sax/features/namespaces",true);
      parser.parse(input);
      Document xDOM = parser.getDocument();
      Node xNode = xDOM.getFirstChild();

      System.out.println("------------DOMPARSER INFO--------------");
      System.out.println(xNode.getNodeName());
      System.out.println(xNode.getLocalName());
      System.out.println(xNode.getPrefix());
      System.out.println(xNode.getNamespaceURI());
      System.out.println(xDOM.getDoctype());


      SAXBuilder builder = new SAXBuilder();
      org.jdom.Document doc = builder.build(new File(source));
      DOMOutputter dOut = new DOMOutputter();
      Document jDOM = dOut.output(doc);


      Node jNode = jDOM.getFirstChild();
      System.out.println("-----------DOMOUTPUTTER INFO------------");
      System.out.println(jNode.getNodeName());
      System.out.println(jNode.getLocalName());
      System.out.println(jNode.getPrefix());
      System.out.println(jNode.getNamespaceURI());
      System.out.println(jDOM.getDoctype());






More information about the jdom-interest mailing list