LINQ to XML selecting next node Elements -
i working on selecting specfic data xml document.
here sample of xml document:
<data> <variable name="somedata"> <row> <column>data</column> <column>data</column> <column>data</column> <column>data</column> <column>data</column> <column>data</column> </row> </variable> <variable name="currentsession"> <row> <column>data get</column> <column>data get</column> <column /> </row> <row> <column>data get</column> <column>data get</column> <column /> </row> </variable> </data>
i have decided linq xml.
this have far:
var doc = xdocument.load(@"d:\currentsession.xml"); var query = d in doc.descendants("row") //where (string)d.attribute("name") == ("currentsession") select (string)d.element("column"); foreach (string name in query) { string xml = "test : " + name + ""; }
my problem @ moment i'am getting data "column" data "column" within scope of <variable name="currentsession">
having difficulty jumping past <row>
can me figuring out how skip row node.
i suppose should first take "variable", filter "where", , take row , column elements:
var doc = xdocument.load(@"d:\currentsession.xml"); var query = (from d in doc.descendants("variable") (string)d.attribute("name") == "currentsession" select d.elements("row")).first().select(row => row.element("column"));
Comments
Post a Comment