相同的名称和相同的值。这取决于您在C.XmlDocument中访问文档的方式?XmlReader?还有别的吗?啊,当然。在C++/CLI中执行,但这应该不是问题。使用XmlDocument事实上,最终的问题是如何使用诸如“//fx:ELEMENTS/fx:
相同的名称和相同的值。这取决于您在C.XmlDocument中访问文档的方式?XmlReader?还有别的吗?啊,当然。在C++/CLI中执行,但这应该不是问题。使用XmlDocument事实上,最终的问题是如何使用诸如“//fx:ELEMENTS/fx:,xml,xsd,c++-cli,xmldocument,Xml,Xsd,C++ Cli,Xmldocument,相同的名称和相同的值。这取决于您在C.XmlDocument中访问文档的方式?XmlReader?还有别的吗?啊,当然。在C++/CLI中执行,但这应该不是问题。使用XmlDocument事实上,最终的问题是如何使用诸如“//fx:ELEMENTS/fx:CLUSTERS/fx:CLUSTER”之类的xPath检索节点?我认为XmlDocument已经过时了-您考虑过迁移到使用XDocument等吗?不太可能。编译器3.5没有给我任何警告 <fx:FIBEX xmlns:fx="http:
相同的名称和相同的值。这取决于您在C.XmlDocument中访问文档的方式?XmlReader?还有别的吗?啊,当然。在C++/CLI中执行,但这应该不是问题。使用XmlDocument事实上,最终的问题是如何使用诸如“//fx:ELEMENTS/fx:CLUSTERS/fx:CLUSTER”之类的xPath检索节点?我认为XmlDocument已经过时了-您考虑过迁移到使用XDocument等吗?不太可能。编译器3.5没有给我任何警告
<fx:FIBEX xmlns:fx="http://www.asam.net/xml/fbx" xmlns:can="http://www.asam.net/xml/fbx/can" xmlns:flexray="http://www.asam.net/xml/fbx/flexray"
xmlns:ho="http://www.asam.net/xml" xmlns:ni="http://www.ni.com/xnet"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.asam.net/xml/fbx/all http://www.asam.net/xml/fbx/2_0_1/xsd/fibex4multiplatform.xsd"
VERSION="2.0.1">
//fx:ELEMENTS/fx:CLUSTERS/fx:CLUSTER
<root xmlns:ns1="http://example.com/namespace-1">
<nothing/>
<default xmlns="http://example.com/default">
<override xmlns=""/>
</default>
<ns1:namespace-1 ns1:attribute-1="x" attribute-2="y"/>
<ns2:namespace-2 xmlns:ns2="http://example.com/namespace-2"/>
</root>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output encoding="utf-8" method="text"/>
<xsl:template match="/">
<xsl:text>Find and print all element names and namespace nodes </xsl:text>
<xsl:apply-templates select="//*|//@*"/>
<xsl:text>End of tests </xsl:text>
</xsl:template>
<xsl:template match="*|@*">
<xsl:text>name = "</xsl:text>
<xsl:value-of select="name(.)"/>
<xsl:text>" </xsl:text>
<xsl:text>namespace URI = "</xsl:text>
<xsl:value-of select="namespace-uri(.)"/>
<xsl:text>" </xsl:text>
<xsl:text>This node has </xsl:text>
<xsl:value-of select="count(./namespace::*)"/>
<xsl:text> namespace nodes: </xsl:text>
<xsl:for-each select="./namespace::*">
<xsl:value-of select="position()"/>
<xsl:text>. namespace prefix = "</xsl:text>
<xsl:value-of select="name(.)"/>
<xsl:text>" namespace URI = "</xsl:text>
<xsl:value-of select="."/>
<xsl:text>" </xsl:text>
</xsl:for-each>
<xsl:text> </xsl:text>
</xsl:template>
</xsl:stylesheet>
Find and print all element names and namespace nodes
name = "root"
namespace URI = ""
This node has 2 namespace nodes:
1. namespace prefix = "xml"
namespace URI = "http://www.w3.org/XML/1998/namespace"
2. namespace prefix = "ns1"
namespace URI = "http://example.com/namespace-1"
name = "nothing"
namespace URI = ""
This node has 2 namespace nodes:
1. namespace prefix = "xml"
namespace URI = "http://www.w3.org/XML/1998/namespace"
2. namespace prefix = "ns1"
namespace URI = "http://example.com/namespace-1"
name = "default"
namespace URI = "http://example.com/default"
This node has 3 namespace nodes:
1. namespace prefix = "xml"
namespace URI = "http://www.w3.org/XML/1998/namespace"
2. namespace prefix = "ns1"
namespace URI = "http://example.com/namespace-1"
3. namespace prefix = ""
namespace URI = "http://example.com/default"
name = "override"
namespace URI = ""
This node has 3 namespace nodes:
1. namespace prefix = "xml"
namespace URI = "http://www.w3.org/XML/1998/namespace"
2. namespace prefix = "ns1"
namespace URI = "http://example.com/namespace-1"
3. namespace prefix = ""
namespace URI = ""
name = "ns1:namespace-1"
namespace URI = "http://example.com/namespace-1"
This node has 2 namespace nodes:
1. namespace prefix = "xml"
namespace URI = "http://www.w3.org/XML/1998/namespace"
2. namespace prefix = "ns1"
namespace URI = "http://example.com/namespace-1"
name = "ns1:attribute-1"
namespace URI = "http://example.com/namespace-1"
This node has 0 namespace nodes:
name = "attribute-2"
namespace URI = ""
This node has 0 namespace nodes:
name = "ns2:namespace-2"
namespace URI = "http://example.com/namespace-2"
This node has 3 namespace nodes:
1. namespace prefix = "xml"
namespace URI = "http://www.w3.org/XML/1998/namespace"
2. namespace prefix = "ns1"
namespace URI = "http://example.com/namespace-1"
3. namespace prefix = "ns2"
namespace URI = "http://example.com/namespace-2"
End of tests