Hi,
I need a nice way to be able to remove all namespace from an XML document in C++. Currently the doc is loaded into a MSXML2::IXMLDOMDocument2Ptr class.
Can't currently see any methods that can do this
Thanks
Hi,
I need a nice way to be able to remove all namespace from an XML document in C++. Currently the doc is loaded into a MSXML2::IXMLDOMDocument2Ptr class.
Can't currently see any methods that can do this
Thanks
There are no methods to do it directly, because the namespace+local-name is inherently the name of the node. The namespace is not some added on property.
You will need to recreate the document with completely new nodes, but this can be done in XSLT more easily:
<xsl:template match='*'>
<xsl:element name='{local-name(.)}'>
<xsl:apply-templates select='*|@*|text()'/>
</xsl:element>
</xsl:template>
<xsl:template match='@*'>
<xsl:attribute name='{local-name(.)}'>
<xsl:value-of select='.'/>
</xsl:attribute>
</xsl:template>
with the default template rules to handle text nodes this should work (but untested).