2011-11-04 134 views
0

我有以下示例xml文件樹視圖和列表視圖控件

<?xml version="1.0" encoding="utf-8" standalone="yes"?> 

    <IResponse xmlns:xsi="http://www.w3.org/2001/XMLScheminstance"       xmlns:xsd="http://www.w3.org/2001/XMLSchema"> 
    <Language>en</Language> 
    <Code>Approved</Code> 
    <Message> Approved</Message> 
    <Info xsi:type="Info"> 
    <Number>11</Number> 
    <ExpiryDate year="10" month="8" /> 
    <StartDate year="7" month="8" /> 
    <currency="GBP">36.00</currency> 

    <ACode>096392</ACode> 
    </IResponse> 

如何顯示在list viewtreeview控制節點和孩子elemants和價值觀?

 public void Deserialize() 
    { 
     XmlReader reader = XmlReader.Create(this.filePath); 
     XmlSerializer serializer = new XmlSerializer(typeof(Response)); 
     if (serializer.CanDeserialize(reader)) 
     { 
      Response obj = serializer.Deserialize(reader) as Response; 

      // obj consists of xml file nodes and i want to display this in treeview 
      // control and values in between them as list view . 
     } 
     else 
     { 
      iccTransactionResponseBindingSource.DataSource = null; 
     } 

    } 
+0

羽絨選民請評論... – 62071072SP

+1

什麼似乎是問題?解析XML或向TreeView添加節點? – Magnus

+0

我完成了解析XML我從來沒有使用過樹視圖控件,所以只是想知道如何添加節點到樹形視圖 – 62071072SP

回答