Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] 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: Christoph LANGE <ch.lange AT jacobs-university.de>
  • To: elharo AT metalab.unc.edu
  • Cc: XOM <xom-interest AT lists.ibiblio.org>, Saxon <saxon-help AT lists.sourceforge.net>
  • Subject: Re: [XOM-interest] Bug (?) in Saxon/DOM/XOM interaction: Attributes instead of namespaces; strange element tree structure
  • Date: Fri, 22 Feb 2008 11:51:26 +0100

On Friday 22 February 2008 04:12:40 Elliotte Harold wrote:
> Christoph LANGE wrote:
> > Dear XOM developers, dear Saxon developers,
> >
> > sorry for crossposting, but this bug is actually related to both XOM
> > and Saxon. As far as I can judge on that, Saxon generates DOM output that
> > is not completely valid and makes XOM's DOMConverter crash.
>
> I'll need to think about this one. However a elf-contained test case
> would be very helpful in figuring out exactly what's going on and whose
> problem it is.

Please see the attached files. In order to run them, make sure that XOM and
Saxon and the current directory are in the classpath, e.g.

java -cp
.:path/to/xom-1.2b2.jar:path/to/saxon/saxon9.jar:path/to/saxon/saxon9-dom.jar
TransformXOMSaxon

Now, after factoring this code out of my project, I was not able to reproduce
exactly the bug I reported, but a similar one:

Error on line 52
Error in call to extension function {public static java.lang.String
XSLTFunctions.render(org.w3c.dom.NodeList)}: Exception in extension function
nu.xom.NamespaceConflictException: Prefixed elements must have namespace
URIs.
Exception in thread "main" ; SystemID: ; Line#: 52; Column#: -1
net.sf.saxon.trans.XPathException: Error in call to extension function
{public
static java.lang.String XSLTFunctions.render(org.w3c.dom.NodeList)}:
Exception in extension function nu.xom.NamespaceConflictException: Prefixed
elements must have namespace URIs.
at
net.sf.saxon.functions.ExtensionFunctionCall.iterate(ExtensionFunctionCall.java:151)
at net.sf.saxon.expr.Expression.evaluateItem(Expression.java:352)
at net.sf.saxon.expr.Expression.process(Expression.java:461)
at net.sf.saxon.instruct.Block.processLeavingTail(Block.java:401)
at net.sf.saxon.instruct.Instruction.process(Instruction.java:94)
at
net.sf.saxon.instruct.ElementCreator.processLeavingTail(ElementCreator.java:298)
at net.sf.saxon.instruct.Template.applyLeavingTail(Template.java:175)
at
net.sf.saxon.instruct.ApplyTemplates.applyTemplates(ApplyTemplates.java:343)
at
net.sf.saxon.instruct.ApplyTemplates.defaultAction(ApplyTemplates.java:376)
at
net.sf.saxon.instruct.ApplyTemplates.applyTemplates(ApplyTemplates.java:331)
at net.sf.saxon.Controller.transformDocument(Controller.java:1735)
at net.sf.saxon.Controller.transform(Controller.java:1559)
at TransformXOMSaxon.main(TransformXOMSaxon.java:27)
Caused by: nu.xom.NamespaceConflictException: Prefixed elements must have
namespace URIs.
at nu.xom.Element._setNamespaceURI(Element.java:864)
at nu.xom.Element.<init>(Element.java:109)
at nu.xom.NodeFactory.startMakingElement(NodeFactory.java:127)
at nu.xom.converters.DOMConverter.makeElement(DOMConverter.java:519)
at nu.xom.converters.DOMConverter.convert(DOMConverter.java:450)
at nu.xom.converters.DOMConverter.convert(DOMConverter.java:443)
at XSLTFunctions.convert(XSLTFunctions.java:19)
at XSLTFunctions.render(XSLTFunctions.java:26)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
net.sf.saxon.functions.ExtensionFunctionCall.invokeMethod(ExtensionFunctionCall.java:533)
at
net.sf.saxon.functions.ExtensionFunctionCall.call(ExtensionFunctionCall.java:256)
at
net.sf.saxon.functions.ExtensionFunctionCall.iterate(ExtensionFunctionCall.java:147)
... 12 more
---------
nu.xom.NamespaceConflictException: Prefixed elements must have namespace URIs.
at nu.xom.Element._setNamespaceURI(Element.java:864)
at nu.xom.Element.<init>(Element.java:109)
at nu.xom.NodeFactory.startMakingElement(NodeFactory.java:127)
at nu.xom.converters.DOMConverter.makeElement(DOMConverter.java:519)
at nu.xom.converters.DOMConverter.convert(DOMConverter.java:450)
at nu.xom.converters.DOMConverter.convert(DOMConverter.java:443)
at XSLTFunctions.convert(XSLTFunctions.java:19)
at XSLTFunctions.render(XSLTFunctions.java:26)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
net.sf.saxon.functions.ExtensionFunctionCall.invokeMethod(ExtensionFunctionCall.java:533)
at
net.sf.saxon.functions.ExtensionFunctionCall.call(ExtensionFunctionCall.java:256)
at
net.sf.saxon.functions.ExtensionFunctionCall.iterate(ExtensionFunctionCall.java:147)
at net.sf.saxon.expr.Expression.evaluateItem(Expression.java:352)
at net.sf.saxon.expr.Expression.process(Expression.java:461)
at net.sf.saxon.instruct.Block.processLeavingTail(Block.java:401)
at net.sf.saxon.instruct.Instruction.process(Instruction.java:94)
at
net.sf.saxon.instruct.ElementCreator.processLeavingTail(ElementCreator.java:298)
at net.sf.saxon.instruct.Template.applyLeavingTail(Template.java:175)
at
net.sf.saxon.instruct.ApplyTemplates.applyTemplates(ApplyTemplates.java:343)
at
net.sf.saxon.instruct.ApplyTemplates.defaultAction(ApplyTemplates.java:376)
at
net.sf.saxon.instruct.ApplyTemplates.applyTemplates(ApplyTemplates.java:331)
at net.sf.saxon.Controller.transformDocument(Controller.java:1735)
at net.sf.saxon.Controller.transform(Controller.java:1559)
at TransformXOMSaxon.main(TransformXOMSaxon.java:27)

This is again because the namespace node xmlns:m on the m:apply element is
misrepresented as an attribute.

Hope that helps,

Christoph

--
Christoph Lange, Jacobs Univ. Bremen, http://kwarc.info/clange, Skype duke4701



Archive powered by MHonArc 2.6.24.

Top of Page