c# - XmlDocument to DataSet only returning 1 Row -


i have problematic piece of code , it's peculiar , nothing i've ever experienced before!

i'm calling sharepoint soap function , results being returned absolutely fine., many xml records of data being retruned.

now have tried convert results xmldocument, use load dataset.

however when gets inserted dataset it's inserting 1 record, happens first record of xml.

the problematic code below:

            lists list = new lists();                            list.url = url + "_vti_bin/lists.asmx";             list.usedefaultcredentials = true;              //gets entire lists attached sharepoint site             xmlnode results = list.getlistcollection();             //writes entire results xmldocument.             doc.appendchild(doc.importnode(results, true));               using (stringreader xmlsr = new stringreader(doc.innerxml))             {                 ds.readxml(xmlsr, xmlreadmode.auto);             } 

the xml 'doc.innerxml' valid , pastable xml notepad 2007, i'm bit @ lost.

i hope can shed light onto this, appreciated

the following example works me:

lists list = new lists(); //sharepoint lists soap service  //perform request xmlnode result = list.getlistcollection();   //process result var ds = new dataset("listsresults"); using (var reader = new stringreader(result.outerxml)) {     ds.readxml(reader, xmlreadmode.auto); }  //print list titles foreach (datarow row in ds.tables[0].rows) {      console.writeline(row["title"]); } 

another common approach utilize linq xml:

lists list = new lists(); //sharepoint lists soap service  //perform request xmlnode result = list.getlistcollection();   var docresult = xdocument.parse(result.outerxml); xnamespace s = "http://schemas.microsoft.com/sharepoint/soap/"; var listentries = le in docresult.descendants(s + "list")                           select new                               {                                   title = le.attribute("title").value                               }; foreach (var e in listentries) {      console.writeline(e.title); } 

Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -