XML Sample 1 : -
<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XMLSPY v5 U (http://www.xmlspy.com) by PHS Group plc
(PHS Group plc) -->
<EntityConfiguration
xmlns="x-schema:C:/QuantivProjects/QuantivT/Scheme/QuantivBase/QTVConfiguration/EntityConfiguration.xdr"
xmlns:dt="urn:schemas-microsoft-com:datatypes">
<MajorVersion>1</MajorVersion>
<MinorVersion>0</MinorVersion>
<EntityDef>
<EntityClassId>601</EntityClassId>
<EntityClassRef>Customer</EntityClassRef>
etc.
XML Sample 2 : -
<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XMLSPY v5 U (http://www.xmlspy.com) by PHS Group plc
(PHS Group plc) -->
<EntityConfiguration>
<MajorVersion>1</MajorVersion>
<MinorVersion>0</MinorVersion>
<EntityDef>
<EntityClassId>601</EntityClassId>
<EntityClassRef>Customer</EntityClassRef>
etc.
Sample Code : -
Dim doc As XmlDocument
Dim xpathExpr As String =
"EntityConfiguration/EntityDef/EntityClassRef"
doc = New XmlDocument
doc.Load(xmlFile)
For Each node As XmlNode In doc.SelectNodes(xpathExpr)
entityList.Add(node.InnerXml)
log(String.Format("{0} - {1} = {2}", node.NodeType, node.Name,
node.InnerXml))
Next
If I run the sample code with XML Sample 1 I get no nodes returned,
however if I run the code with XML Sample 2 I get the expected node
set.
Could someone explain to me why this is?
Many thanks,
- Andy