XML : How to select particular node from XML

I have this XML:

  <?xml version="1.0"?>      <Document xmlns="urn:somethinghere">          <fapx.001.02>              <Sts>                  <StsVal>ACCEPTED</StsVal>              </Sts>          </fapx.001.02>      </Document>    

I want to select value of "StsVal" and for that I wrote this code but getting error:

Code

  Dim doc As XmlDocument = New XmlDocument()  doc.Load("myfile.xml")  Dim response As String = doc.SelectSingleNode("Document/fapx.001.02/Sts/StsVal").InnerText    

Error

Object reference not set to an instance of an object.

No comments:

Post a Comment