The only way we know to find out the namespaces prefixes used in the document (such as p and ci in your sample XML document), without using IMXNamespaceManager, is to iterate over the attributes collection, as shown in the following VB sample:
Save your XML document as c:\1.xml
<?xml version="1.0"?>
<group xmlns:p='urn:example-org:People' xmlns:ci="IjustWannaFindThisPrefix">
<p:date>1970-09-30</p:date>
<p:degrees>67.5</p:degrees>
</group>
Add reference to MSXML 4.0 in a VB (Visual Basic) app and write the following code:
Dim objXML As New MSXML2.DOMDocument40
objXML.async = False
objXML.validateOnParse = False
If objXML.Load("c:\1.xml") Then
For Each nsAttr In objXML.documentElement.Attributes
MsgBox nsAttr.baseName
Next
Else
'Failed to load the document, do error handling
End If
|