Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] [saxon] Bug (?) in Saxon/DOM/XOM interaction:Attributes instead of namespaces; strange element tree structure

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: Elliotte Harold <elharo AT metalab.unc.edu>
  • To: Michael Kay <mike AT saxonica.com>
  • Cc: 'XOM' <xom-interest AT lists.ibiblio.org>, 'Mailing list for the SAXON XSLT and XQuery processor' <saxon-help AT lists.sourceforge.net>
  • Subject: Re: [XOM-interest] [saxon] Bug (?) in Saxon/DOM/XOM interaction:Attributes instead of namespaces; strange element tree structure
  • Date: Sat, 29 Mar 2008 07:06:00 -0700

Michael Kay wrote:

I tested this by taking Saxon out of the equation: if the program is reduced
to:

DocumentBuilderFactory df = DocumentBuilderFactory.newInstance();



DocumentBuilderFactory is evil. Your mistake (and probably the original mistake) is forgetting to make it namespace aware like so:

df.setNamespaceAware(true);

sad but true: DocumentBuilderFactory is broken unless you explicitly turn on namespace handling.


org.w3c.dom.Document doc = df.newDocumentBuilder().parse(new
File("mmlkit.xml"));
Element outer = doc.getDocumentElement();
NodeList outerKids = outer.getChildNodes();
DOMConverter.convert ((org.w3c.dom.Element) outerKids.item (1));

then it fails with the same error.

Michael Kay
http://www.saxonica.com/

_______________________________________________
XOM-interest mailing list
XOM-interest AT lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/xom-interest


--
Elliotte Rusty Harold elharo AT metalab.unc.edu
Java I/O 2nd Edition Just Published!
http://www.cafeaulait.org/books/javaio2/
http://www.amazon.com/exec/obidos/ISBN=0596527500/ref=nosim/cafeaulaitA/



  • Re: [XOM-interest] [saxon] Bug (?) in Saxon/DOM/XOM interaction:Attributes instead of namespaces; strange element tree structure, Elliotte Harold, 03/29/2008

Archive powered by MHonArc 2.6.24.

Top of Page