views:

116

answers:

1

The GetListitems web service relies on XML to retrieve data from SharePoint.

Some actual working code is:

var doc = new XmlDocument();
            doc.LoadXml("<Document><Query><Where><Contains><FieldRef Name=\"DeliveryStatus\" /><Value Type=\"Text\">Created</Value></Contains></Where></Query><ViewFields /><QueryOptions /></Document>");
            XmlNode listQuery = doc.SelectSingleNode("//Query");
            XmlNode listViewFields = doc.SelectSingleNode("//ViewFields");
            XmlNode listQueryOptions = doc.SelectSingleNode("//QueryOptions");
            XmlNode items = wsLists.GetListItems(ListName, string.Empty, listQuery, listViewFields, string.Empty, listQueryOptions, null);

Once XMLNode is populated, is there a tried and tested way to traverse the collection of childnodes?

I know how to do this using .net general techniques, but what concerns me is that there might be some pitfalls I am unaware of. For example, I noticed the firstChild and lastChild are empty during some of my tests. I wonder if this is an exception rather than a rule. Its impossible to know from MSDN documentation, so if any of you guys have experience with this please share.

Thanks in advance

+1  A: 

You mean FirstChild and LastChild sometimes are empty? Well, if you have tags like <QueryOptions /> and such, then it means they have no childs. By logic I guess that those properties must be empty then.

Or is there any other problem than that?

Janis Veinbergs
There will be, but it seems for now, my stuff is working
JL