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?