日期:2014-05-17 浏览次数:20898 次
<?xml version="1.0" ?>
<report_ds>
<index_list>
<item ves_name="LMCA" depth="56" vs="82" vd="65" vm="73" pi="2.3" ri="1.2" hr="66" li="-"/>
<item ves_name="RMCA" depth="56" vs="81" vd="62" vm="71" pi="1.3" ri="0.2" hr="63" li="-"/>
</index_list>
</report_ds>
XmlDocument xml = new XmlDocument();
xml.LoadXml(@"<report_ds><index_list><item ves_name='LMCA' depth='56' vs='82' vd='65' vm='73' pi='2.3' ri='1.2' hr='66' li='-'/>
<item ves_name='RMCA' depth='56' vs='81' vd='62' vm='71' pi='1.3' ri='0.2' hr='63' li='-'/>
</index_list>
</report_ds>");
XmlNode node = xml.SelectSingleNode(@"report_ds/index_list/item");
int childNodeCount = node.ChildNodes.Count;//item节点的子节点个数
int itemAttrCount = node.Attributes.Count;//item节点的属性个数
for (int i = 0; i < itemAttrCount; i++)
{
string attrName = node.Attributes[i].Name;//属性名称
string attrValue = node.Attributes[i].Value;//属性值
}