Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 如何使用MSXML从XML文档中获取名称空间前缀?_C++_Xml_Msxml - Fatal编程技术网

C++ 如何使用MSXML从XML文档中获取名称空间前缀?

C++ 如何使用MSXML从XML文档中获取名称空间前缀?,c++,xml,msxml,C++,Xml,Msxml,例如, 在本文件中 < ?xml version="1.0" ? > < SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xm

例如,
在本文件中

< ?xml version="1.0" ? >   

< SOAP-ENV:Envelope 

xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" 

xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" 

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 

xmlns:xsd="http://www.w3.org/2001/XMLSchema" 

xmlns:ns1="http://opcfoundation.org/webservices/XMLDA/1.0/" 

xmlns:ns2="Service"> 

< SOAP-ENV:Body id="_0" >




如果我需要选择元素“Body”,我需要知道前缀“SOAP-ENV”。我怎么能得到这个?获取一个根元素并切掉冒号(:)对我来说似乎是一个肮脏的想法,我相信应该有一个整洁的方法来做到这一点。谷歌没有帮助(可能是我没有搜索正确的东西)。

如果你正在处理XML,你不需要知道前缀

要在XML文档中选择节点,您不需要知道前缀。您需要知道名称空间,而不是前缀


如果您正在处理SOAP文档,那么您知道名称空间是
http://schemas.xmlsoap.org/soap/envelope/
。这就是你所需要的。在XML应用程序中,可以指定自己的名称空间前缀

谢谢,让我明天试试。