c# - how to parse this Xml type string -
can 1 guide me how parse xml type string ?
<data> <lastupdate></lastupdate> <ac1>12</ac1> <ac2>13</ac2> <ac3>14</ac3> <moter></moter> <fan1></fan1> <fan2></fan2> <tubelight1></tubelight1> <tubelight2></tubelight2> <moter></moter> <closeall></closeall> </data> i need result in string or list or dictionary ac1=12 , ac2=13 , on
thnaks in advance
this should work have remove duplicate moter element xml - can use dictionary:
xdocument doc = xdocument.load("test.xml"); var dictionary = doc.descendants("data") .elements() .todictionary(x => x.name.tostring(), x => x.value); string ac1value = dictionary["ac1"];
Comments
Post a Comment