Get all namespace prefix from XmlDocument class

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • John Lee

    Get all namespace prefix from XmlDocument class

    Hi,

    if I have xml document
    <root xmlns:a="myNS1" xmlns:b="myNS2" xmlns="myNS">
    <a:node1>value1 </a:node1>
    <b:node2>value2 </b:node2>
    <node3>value3 </node3>
    </root>

    if I load the above xml in XmlDocument, I can get the namespaceURI "myNS1"
    usnig .GetNamespaceOf Prefix("a")

    Could someone tell me how to get/enumerate all namespace prefixes and
    namespaceURIs?

    Thanks very much!
    John


  • Kevin Yu [MSFT]

    #2
    RE: Get all namespace prefix from XmlDocument class

    Hi John,

    First of all, I would like to confirm my understanding of your issue. From
    your description, I understand that you need to enumerate all namespace
    prefixes and URIs in an XmlDocument. If there is any misunderstandin g,
    please feel free to let me know.

    As far as I know, there are no methods or properties in XmlDocument for us
    to get all the namespaces in an Xml. However, here is an article using XSL
    to search for all namespaces in an Xml.



    HTH.

    Kevin Yu
    =======
    "This posting is provided "AS IS" with no warranties, and confers no
    rights."

    Comment

    Working...