|
-
Feb 22nd, 2010, 08:54 PM
#1
Thread Starter
Fanatic Member
[RESOLVED] Retrieving XML into document
I'm trying to retrieve xml information from an XMLDocument object, but I'm getting an error.
I'm using Visual Studio 2008, I have this XML as a string :
<customerresponse status="valid">
<custid>58485843543</custid>
<message>Submission Accepted</message>
</customerresponse>
This is my code:
Dim XMLResult as new XMLDocument
XMLResult.LoadXML(xmlstring)
status = XMLResult.Item("customerresponse").Attributes("status").Value
message = XMLResult.Item("customerresponse").Item("message").Value
The first line (status) works perfectly to retrieve the attribute, but the second line ( message ) gives me a Null Reference error when trying to get the value in the sub-node.
The Item is supposed to be an XMLElement, which should include its sub-elements, I would think. What am I doing wrong here?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|