c# - How to parse an ArrayOfXElement in Windows Phone? -


i'm trying connect asmx web service , code generated in windows phone project different in windows forms. in windows forms, methods of web service returns dataset, go through rows in existing tables of object:

myobject myobject = new myobject(); dataset dataset = soapclient.somemethod(); foreach (datatable table in dataset.tables) {     foreach (datarow row in table.rows)     {         myobject.someproperty = row["someproperty"];         myobject.someotherproperty = row["someotherproperty"];     } } 

but in windows phone generates async version of method subscribe event fires when request completed. , event args brings me arrayofxelement, seems windows phone version of dataset object. how parse this?

before mark question duplicated, know other answers available in site not working.

alright, managed working. web service method return 2 xelements, first 1 header, declaring what's coming next. ignore first xelement, , inside newdataset element there's table element, has content want.

bool first = true; foreach (xelement xel in e.result.nodes) {     if (first)     {          // ignore first xelement         first = false; continue;     }      var datasetelement = xel.element("newdataset");     var tableelement = datasetelement.element("table");      // , here's useful data     tableelement.element("property1").value;     tableelement.element("property2").value; } 

notice gets first table row. if there's more 1 table row, you'll find others rows msdata:roworder attribute.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -