I'm racking my head over this!!!
I have a simple XML file
It loads and works perfect when I use msxml2, but I can't use msxml2 because of another issue.
Anyways, in the code below
Anyone have anyclue why this could be? When I look at the node counts under the documents in the msxml2 doc there are 9, but in the xmldoc there are 3?
THis makes no sense. Please help me in figureing out how to select nodes and get this to work using the XMLDocument, or any other alternative that doesn't require needing to add a referance to the project.
Thanks
I have a simple XML file
VB.NET:
<?xml version="1.0" encoding="utf-8"?>
<GetPhoneInfoResult xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.serviceobjects.com/">
<PhoneInfo>
<PhoneNumberIn>18556955554</PhoneNumberIn>
<PhoneNumberClean>8556955554</PhoneNumberClean>
<Providers>
<Provider>
<Name>AMERITECH ILLINOIS</Name>
<City>NEWARK</City>
<State>ILLINOIS</State>
<LineType>LANDLINE</LineType>
<Latitude>41.5177</Latitude>
<Longitude>-88.5187</Longitude>
</Provider>
</Providers>
<Contacts>
<Contact>
<Name>JOHN DOE</Name>
<Address>1234 Nothing</Address>
<City>NEWARK</City>
<State>IL</State>
<Zip>12345</Zip>
<Type>RESIDENTIAL</Type>
<Quality>HIGH</Quality>
</Contact>
</Contacts>
</PhoneInfo>
<TokensUsed>65</TokensUsed>
<DEBUG />
</GetPhoneInfoResult>
It loads and works perfect when I use msxml2, but I can't use msxml2 because of another issue.
Anyways, in the code below
VB.NET:
'THIS WORKS
Dim y As New MSXML2.DOMDocument30
y.loadXML(result)
Dim d As MSXML2.IXMLDOMNode = y.selectSingleNode("//Contacts/Contact")
'THIS DOES NOT!!!
dim _str as System.xml.XMLDOCUMENT
_Str.LoadXml(result)
Dim n As System.Xml.XmlNode = _Str.SelectSingleNode("//Contacts/Contact")
Anyone have anyclue why this could be? When I look at the node counts under the documents in the msxml2 doc there are 9, but in the xmldoc there are 3?
THis makes no sense. Please help me in figureing out how to select nodes and get this to work using the XMLDocument, or any other alternative that doesn't require needing to add a referance to the project.
Thanks