i trying parse xml file using linq:
the xml structure seems done via attributes instead of element names. entry , entries specific entry name e.g "data": example data below.
<entry name="data"> <entry name="001" description="player left"> <entry name="001" description="player left" type="richtext">joe bloggs</entry> </entry> <entry name="002" description="team left"> <entry name="002" description="team left" type="richtext">stack overflow</entry> </entry> there 2 entries or 100 need return under "data" attribute in case.
currently have is:
xdocument doc = xdocument.load(@"d:\element1.xml"); var stuff = doc.descendants("entry").where(x => (string)x.attribute("data") == "data").tolist(); i can specific values not whole lot.
i going take stab @ this. following want?
doc .descendants() .where(x => (string)x.attribute("name") == "data") .descendants();
Comments
Post a Comment