Trouble Parsing XML

I am having some trouble parsing some XML from centovacast v3 XML API. I've worked with their 2.x API and parsed it, but the responses have totally changed and I cannot seem to make any of my existing parsers work. Every example I've tried I cannot seem to get at the data correctly. I'm using .NET 3.5 (4.0 is acceptable as well), any examples would be greatly appreciated.An example XML document is:\[code\]<?xml version=""1.0"" encoding=""UTF-8""?><centovacast version=""3.0.0"" host=""0.0.0.0:2199""> <response type=""success""> <message>OK</message> <data> <row> <id>1</id> <parameters> <ipaddress>127.0.0.1</ipaddress> <port>2198</port> <title>Local server</title> <isrelay>1</isrelay> <ismaster>1</ismaster> <defaultip>0.0.0.0</defaultip> <daemontype>RPC</daemontype> <hostname/> </parameters> <status> <memfree>101879808</memfree> <memtotal>1073741824</memtotal> <memavail>778653696</memavail> <swapfree>1077501952</swapfree> <swaptotal>1077501952</swaptotal> <buffers>172535808</buffers> <cpuload>0.00</cpuload> <uptime>13372713</uptime> <machine>Intel(R) Xeon(R) CPU E5620</machine> <osbrief>Linux</osbrief> <osdetails>2.6.18</osdetails> <other> <Processes> <field>n</field> <field>72</field> </Processes> <Kernel> <field>s</field> <field>Linux version 2.6.18</field> </Kernel> <row> <field>f</field> <field>0.000000</field> </row> <row> <field>f</field> <field>0.000000</field> </row> <row> <field>f</field> <field>0.000000</field> </row> </other> <online>1</online> </status> <accounts> <licensed>-1</licensed> <active>1</active> <inactive>0</inactive> </accounts> </row> </data> </response></centovacast>\[/code\]I've tried using the following code:\[code\] var xml = XDocument.Parse(xmldata); var query = from p in xml.Descendants("status") select p; foreach (var record in query) MessageBox.Show(record.Value);\[/code\]but it returns all the data inside the \[code\]<status>\[/code\] and \[code\]<parameters>\[/code\] in one big jumble, rather then in separate values.I would love to serialize / deserialize, as the XML call I'm making returns the above for each server in the cluster, so it could be quite a large result set, but I am not picky, I would be happy just being able to get the data into the correct variables so I can use them.
 
Back
Top