开发者

how to get namespace prefixes from XML document, using MSXML?

For example,

In this document

< ?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" >

if I need to select the element "Body", I need to know the prefix "SOA开发者_如何学CP-ENV". How can I get that? getting a root element and slicing the colon (:) off seems a dirty idea to me, I am sure there should be a neat way to do that. Google does not help (may be I am not searching for the right thing).


If you're doing XML processing you shouldn't need to know the prefix.

To select a node in an XML document, you need not know the prefix. You need to know the namespace, not the prefix.

If you are processing a SOAP document, then you know the namespace is http://schemas.xmlsoap.org/soap/envelope/. And that's all you need. In the XML application, you can assign your own namespace prefix.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜