<?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <soap:Body> <BarcodePrintZplResponse> <BarcodePrintZplResult>Object reference not set to an instance of an object.</BarcodePrintZplResult> </BarcodePrintZplResponse> </soap:Body> </soap:Envelope>
Answers
First - by specifying the fully qualified path to the node you want to select. i.e. //soap:Envelope/soap:Body/BarcodePrintZplResponse/BarcodePrintZplResult, or...
Second - by specifying a relative path to the node. One way might be to use //BarcodePrintZplResult as your XPath query.
Those two things being said - the XML document you posted doesn't pass my validator. The semicolons between the xmlns declarations are causing it to fail. I had to remove them to get the document to pass. I also had to remove the xmlns declaration on the BarcodePrintZplResponse node to get the Xpath expression to return results. Not sure why that namespace is declared there.
After making those minor edits, though, the following XML document returned the desired result when using the xpath expression //BarcodePrintZplResult
When I call XmlDocResponse.selectNodes('BarcodePrintZplResult') there is no NullReferenceException.