[xml] Parsed entities in namespaces (non-html version)


Sorry for sending this twice - I sent it in HTML by mistake.

I think I might have stumbled across a problem with the way libxml handles
entities when the reference is inside a default namespace. (I am using

-- a.xml --
<?xml version="1.0"?>
<!DOCTYPE root SYSTEM "" [
<!ENTITY element "<child_entity/>">
<root xmlns="http://www.test.com/test";>

If I run the following XSLT against this xml (to output the namespace of
each element)
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; >
  <xsl:template match="node()">
    <xsl:value-of select="name()"/><xsl:text>: </xsl:text>
    <xsl:value-of select="namespace-uri()"/><xsl:text>

I get
root: http://www.test.com/test
child: http://www.test.com/test

Why isn't the "child_entity" in the default namespace as well? From what I
can tell reading the XML and Namespace specs, my xml document should be
directly equivalent to:
<?xml version="1.0"?>
<root xmlns="http://www.test.com/test";>

Is this a bug with libxml, or have I misunderstood something?


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