首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > XML SOAP >

XmlDocument 嵌套使用功法

2013-10-12 
XmlDocument 嵌套使用心法XmlDocument xmlDoc new XmlDocument()xmlDoc.LoadXml(strXml)XmlNodeList x

XmlDocument 嵌套使用心法

XmlDocument xmlDoc = new XmlDocument();
           xmlDoc.LoadXml(strXml);

           XmlNodeList x = xmlDoc.SelectNodes("/NETBOX/RESPONSE/DETAILS/PERSONID");

           for (int i = 0; i < x.Count; i++)
           {
               // MessageBox.Show(x.Item(i).NextSibling.NextSibling.InnerXml);
               XmlDocument xmlDocN = new XmlDocument();
               string strXmlAccessS = x.Item(i).NextSibling.NextSibling.InnerXml;
               strXmlAccessS = "<ROOT>" + strXmlAccessS + "</ROOT>";
               xmlDocN.LoadXml(strXmlAccessS);

               XmlNodeList dttm = xmlDocN.SelectNodes("/ROOT/ACCESS/DTTM");
               for (int j = dttm.Count - 1; j >= 0 ; j--)
               {
                   Item it = new Item();
                   if (j == dttm.Count - 1)
                   {
                       it.bChangeFlag = true;
                   }
                   it.strPERSONID = x.Item(i).InnerXml;
                   it.strDTTM = dttm.Item(j).InnerText;
                   AddItem(it);
               }

           }

热点排行