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



Hi

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
libxml2-2.6.11)

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

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>
</xsl:text>
   <xsl:apply-templates/>
  </xsl:template>
</xsl:stylesheet>

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

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";>
<child/>
<child_entity/>
</root>

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

Thanks,
Richard




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