need help reading xml

I am trying to read the following xml and I'm getting a null values when I try to access any node beyond the soap:Body node. Any ideas what I'm doing wrong?

[code]<?xml version="1.0" encoding="utf-8"?>











SampleTest7/10555
SampleTest7


SampleTest8/10555
SampleTest8




[/code]

[code]XmlDocument xDoc = new XmlDocument();
xDoc.LoadXml(new StreamReader(sUploadPath).ReadToEnd());
XmlNamespaceManager nsmgr = new XmlNamespaceManager(xDoc.NameTable);
nsmgr.AddNamespace("soap", "http://schemas.xmlsoap.org/soap/envelope/");
nsmgr.AddNamespace("xsi", "http://www.w3.org/2001/XMLSchema-instance");

XmlNodeList jobs = xDoc.SelectNodes("//soap:Envelope/soap:Body/xsi:PostAdvert/Adverts/PostAdvert", nsmgr);
Console.WriteLine(jobs.Count);[/code]
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories