- Home /
Question by
benfattino · Feb 05, 2016 at 01:33 PM ·
xmlnodes
XML SelectNodes
I try retrive specific XML node a get child value:
XML:
<Brands>
<Brand brand_name="Brioni">
<Season season_name = "AI_2015">
<Collection collection_name = "Pippo">
<Model model_name = "Abito_01">
<ConfigName>Config_01</ConfigName>
<ConfigName>Config_02</ConfigName>
</Model>
<Model model_name = "Abito_02">
<ConfigName>Config_03</ConfigName>
<ConfigName>Config_04</ConfigName>
</Model>
</Collection>
</Season>
</Brand>
</Brands>
And the code:
XmlDocument doc = new XmlDocument ();
doc.LoadXml (myXmlString.ToString ());
XmlNodeList modellist;
XmlNode root = doc.DocumentElement;
modellist =root.SelectNodes("//Brand[@brand_name='Brioni']/Season[@season_name='AI_2015']/Collection[@collection_name='Pippo']");
foreach (XmlNode elem in modellist){
Debug.log (elem.Attributes ["model_name"].Value);
}
Doesn't work... Somebody can help me?
Comment
Your answer
Follow this Question
Related Questions
A node in a childnode? 1 Answer
How to access embedded nodes without system.xml 1 Answer
XML parsing and create UI 0 Answers
XML parser, how to get to 1 of many elements with the same name. 1 Answer
web page html parsing 1 Answer