hi guys im kinda new with using xml with c#.
XML CODE:
<LVL2> <Tables> <TBL_ID>1</TBL_ID> <TBL_Name>test1</TBL_Name> <MD_ID>1</MD_ID> <Tables> <Tables> <TBL_ID>2</TBL_ID> <TBL_Name>test2</TBL_Name> <MD_ID>1</MD_ID> </Tables> <Tables> <TBL_ID>3</TBL_ID> <TBL_Name>test3</TBL_Name> <MD_ID>1</MD_ID> </Tables> </LVL2> <LVL2> <Tables> <TBL_ID>1</TBL_ID> <TBL_Name>test4</TBL_Name> <MD_ID>2</MD_ID> </Tables> <Tables> <TBL_ID>2</TBL_ID> <TBL_Name>test5</TBL_Name> <MD_ID>2</MD_ID> </Tables> <Tables> <TBL_ID>3</TBL_ID> <TBL_Name>test6</TBL_Name> <MD_ID>2</MD_ID> </Tables> </LVL2>
how do I insert to a checklistbox the text values from tbl_name that has an md_id = 1 only. here is my current code.
while (xmlReader.Read()) { switch (xmlReader.NodeType) { case XmlNodeType.Element: elName = xmlReader.Name; break; case XmlNodeType.Text: if (elName == "TBL_Name" && MD_ID == "1") { checkedListBox2.Items.Add(xmlReader.Value); } break; } }
i cant seem to figure out on how to get the text that has MD_ID = "1" and output
test4 test5 test6
No comments:
Post a Comment