得到的childNodes我有喜欢的xml:从XML节点
<?xml version="1.0" encoding="utf-8" ?>
<response list="true">
<count>10748</count>
<post>
<id>164754</id>
<text></text>
<attachments list="true">
<attachment>
<type>photo</type>
<photo>
<pid>302989460</pid>
</photo>
</attachment>
</attachments>
我需要检查,如果在我的<post>
的<attachment>
。 我得到的所有帖子是这样的:
XmlNodeList posts = XmlDoc.GetElementsByTagName("post");
foreach (XmlNode xnode in posts)
{
//Here I have to check somehow
}
如果在后无<attachment>
节点,我想它的<text>
代替。
你要得到什么?元素或值的列表? – lexeRoy 2013-05-09 00:50:16