bug-classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug classpath/36221] DomDOMException running SPEC jvm 2008 xml.transfor


From: gnu_andrew at member dot fsf dot org
Subject: [Bug classpath/36221] DomDOMException running SPEC jvm 2008 xml.transform
Date: 25 Jun 2008 21:12:19 -0000


------- Comment #3 from gnu_andrew at member dot fsf dot org  2008-06-25 21:12 
-------
It took a while to track down the cause, but the problem is as follows.  The
file page.xsl in jennitennison contains:

<xsl:template match="html:*">
        <xsl:element name="{local-name()}">
                <xsl:copy-of select="@*" />
                <xsl:apply-templates />
        </xsl:element>
</xsl:template>

The local-name method is meant to return the local part of the tag name (i.e.
minus the namespace).  The tag in question ends up being my:doc, where my is
the prefix and the local name (which should be returned) is 'doc'.  However,
getLocalName in gnu.xml.xpath.Expr was returning an empty string, after
converting this from the null value returned by
gnu.xml.dom.DomElement.getLocalName().

So why is the local name null when all tags should have a local name?  It turns
out that the prefix, local name and namespace are only filled in if the
createElementNS method of org.w3c.dom.Document is used.  If createElement is
used, just the name is used and the other three values are null.

So why are we creating the input XML tree with createElement and not
createElementNS? It turns out that this particular tree is being created by the
gnu.xml.transform classes from a SAX source, which is created without namespace
awareness turned on.  Adding one line to gnu.xml.transform.XSLURIResolver to
create a SAX sink with namespace awareness on instead causes the test to
complete.

So a bug that took about three hours to track down turns out to be a
one-liner... ;)


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36221





reply via email to

[Prev in Thread] Current Thread [Next in Thread]