Frustrated with XML into a dataset to read

g000we

Member
Joined
Mar 22, 2007
Messages
8
Programming Experience
1-3
Frustrated with extracting XML node information

Hello,

I am having issues with loading a string which contains XML into a xml document then reading the node.

The XML I get back looks something like this..

HTML:
<?xml version="1.0" encoding="ISO-8859-1" ?> <answer details="(&apos;03/Sep/07 15:53&apos;)" >TEXT-1234</answer>
I place this into a string (strXML), and then load this into an XML document.
How do I load the node "answer" and get the value of that node?

VB.NET:
Dim xDoc As New XmlDocument
xDoc.LoadXml(strXML)

Dim xNodeText As String
xNodeText = xDoc.SelectSingleNode("ANSWER").InnerText '<<ERRORS HERE!
Dim ansArr As Array = Split(xNodeText, "-")
thetext =  ansArr(0)
theNumber = ansArr(1)

I get a system.nullreferenceexception and this message "Object reference not set to an instance of an object."

Any help would be greatly appreciated.

Kind Regards,

g000we
 
Last edited:
Xml is case-sensitive. "ANSWER" and "answer" are different nodes.
 
Ok bad title, I agree.
I tried to implement the strXML into a dataset but gave up in the end, so started using the XML document and node objects.

Cheers for all your help geezers! :) You're a light to the .NET vibes. Keep it funky.
 
Back
Top