I have the following code snipet:
....
_xmldocManifest.Load(strManifestAbsolutePath)
Dim manifestNSManager As XmlNamespaceManager = New
XmlNamespaceManager(_xmldocManifest.NameTable)
manifestNSManager.AddNamespace(String.Empty,
"http://www.imsproject.org/xsd/imscp_rootv1p1p2")
manifestNSManager.AddNamespace("ns",
"http://www.imsproject.org/xsd/imscp_rootv1p1p2")
manifestNSManager.AddNamespace("adlcp",
"http://www.adlnet.org/xsd/adlcp_rootv1p2")
manifestNSManager.AddNamespace("xsd", "http://www.w3.org/2001/XMLSchema")
manifestNSManager.AddNamespace("xsi",
"http://www.w3.org/2001/XMLSchema-instance")
manifestNSManager.AddNamespace("schemaLocation",
"http://www.imsproject.org/xsd/imscp_rootv1p1p2 imscp_rootv1p1p2.xsd
http://www.imsglobal.org/xsd/imsmd_rootv1p2p1 imsmd_rootv1p2p1.xsd
http://www.adlnet.org/xsd/adlcp_rootv1p2 adlcp_rootv1p2.xsd")
manifestNSManager.PushScope()
However the following statement returns nothing (for the XML below):
_xmldocManifest.SelectSingleNode("//metadata", manifestNSManager)
But if I remove the first attribute of the manifest node
(xmlns=http://www.imsproject.org/xsd/imscp_rootv1p1p2) it works fine and I
can navigate the xml document with no problems. Any thoughts?
Note the following state works fine without removing the attribute:
_xmldocManifest.SelectSingleNode("//adlcp:location", manifestNSManager)
XML SNIPET:
<?xml version="1.0" encoding="UTF-8"?>
<manifest xmlns="http://www.imsproject.org/xsd/imscp_rootv1p1p2"
xmlns:adlcp="http://www.adlnet.org/xsd/adlcp_rootv1p2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.imsproject.org/xsd/imscp_rootv1p1p2
imscp_rootv1p1p2.xsd http://www.adlnet.org/xsd/adlcp_rootv1p2
adlcp_rootv1p2.xsd"
identifier="x-ims-plirid-v0.DUNS.05-107-9929.mfstid.en_US_11953">
<metadata>
<schema>ADL SCORM</schema>
<schemaversion>1.2</schemaversion>
<adlcp:location>en_US_11953/en_US_11953.xml</adlcp:location>
</metadata>
</manifest>