<categories>
<category text="Arts">
<category>
<category text="Design"/>
<category text="Visual Arts"/>
<category>
</category>
<category text="Business">
<category>
<category text="Business News"/>
<category text="Careers"/>
<category text="Investing"/>
</category>
</category>
<category text="Comedy"/>
</categories>
現在私は使用しています
xDoc.Descendants("category").Where(a => a.Attribute("text").Value == "Arts").Descendants("category")
上記のコードは、属性「Arts」を持つカテゴリからすべてのカテゴリ要素を返します。私が欲しいのは、属性「Arts」を持つカテゴリのすぐ下のカテゴリのノードのみです。テキスト属性のデザインと視覚芸術のカテゴリではありません。以下のようなカテゴリノード全体が必要です
<category>
<category text="Design"/>
<category text="Visual Arts"/>
<category>