xml - looking for help parsing SOAP response in C# -
i'm looking in parsing soap response this:
<?xml version="1.0"?> - <s:envelope xmlns:d="http://schemas.microsoft.com/xw/2004/10/dssp.html" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:s="http://www.w3.org/2003/05/soap-envelope"> - <s:header> <wsa:to>http://10.226.88.13:56031/</wsa:to> <wsa:action>http://schemas.microsoft.com/xw/2004/10/dssp.html:getresponse</wsa:action> -<d:timestamp> <d:value>2016-08-10t16:24:46.3329154z</d:value> </d:timestamp> <wsa:relatesto>uuid:36d92433-4e72-47e5-8e8f-fc2b9a7344aa</wsa:relatesto> </s:header> -<s:body> -<somedatadat xmlns="http://schemas.corp.com/2009/02/somedata.html"> -<somedataarray> -<somedata> -<column1> <string>sales some1</string> <string>sales some2</string> <string>sales some3</string> <string> </string> <string> </string> <string> </string> <string> </string> <string> </string> </column1> -<column2> <float>0.061</float> <float>0.07</float> <float>0.08</float> <float>0</float> <float>0</float> <float>0</float> <float>0</float> <float>0</float> </column2> -<column3> <short>0</short> <short>0</short> <short>0</short> <short>0</short> <short>0</short> <short>0</short> <short>0</short> <short>0</short> </column3> -<column4> <decimal>0.0000</decimal> <decimal>0.0000</decimal> <decimal>0.0000</decimal> <decimal>0.0000</decimal> <decimal>0.0000</decimal> <decimal>0.0000</decimal> <decimal>0.0000</decimal> <decimal>0.0000</decimal> </column4> -<noncolumn6> <string> </string> <string> </string> <string> </string> <string> </string> <string> </string> <string> </string> <string> </string> <string> </string> </noncolumn6> -<column6> <string> </string> <string> </string> <string> </string> <string> </string> <string> </string> <string> </string> <string> </string> <string> </string> </column6> -<column7> <string> </string> <string> </string> <string> </string> <string> </string> <string> </string> <string> </string> <string> </string> <string> </string> </column7> -<column8> <string> </string> <string> </string> <string> </string> <string> </string> <string> </string> <string> </string> <string> </string> <string> </string> </column8> -<column9> <string> </string> <string> </string> <string> </string> <string> </string> <string> </string> <string> </string> <string> </string> <string> </string> </column9> -<column10> <short>0</short> <short>0</short> <short>0</short> <short>0</short> <short>0</short> <short>0</short> <short>0</short> <short>0</short> </column10> -<column11> <short>0</short> <short>0</short> <short>0</short> <short>0</short> <short>0</short> <short>0</short> <short>0</short> <short>0</short> </column11> </somedata> </somedataarray> <variablerecordcount>1</variablerecordcount> </somedatadat> </s:body> </s:envelope>
i want extract 'somedata', table. code looks this:
namespace filereadtesting { public class sometable { public static void main(string[] args) { xnamespace ns = "http://schemas.corp.com/2009/02/somedata.html"; string filename = "somedata.xml"; xdocument xmlfile = xdocument.load(filename); ienumerable<xelement> table = el in xmlfile.descendants(ns + "somedataarray") select el; foreach (xelement el in table) console.writeline(el.value); console.writeline("hit enter end"); console.readline(); } } }
and not getting job done, since output is
"sales some1sales some2sales some30.0610.070.0800000000000000.00000.00000.00000.00000.00000.00000.00000.00000000000000000000"
i'm not sure how best read data table instead of long string.
Comments
Post a Comment