私は次のような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>
に があるかどうかを確認する必要があり<attachment>
ます<post>
。私はこのようなすべての投稿を取得しています:
XmlNodeList posts = XmlDoc.GetElementsByTagName("post");
foreach (XmlNode xnode in posts)
{
//Here I have to check somehow
}
投稿にノードがない場合は、代わり<attachment>
に取得したいと思います。<text>