特定の XPath クエリに一致する XML ファイル内のすべての内部値を返すことができる C# を使用する方法があるかどうか疑問に思っています。
exampleWithFruits.xml という名前の次の Xml ファイルがあるとします。
<fruits>
<bananas>
<banana id="1" color="yellow" price="0.5" />
<banana id="2" color="yellow" price="0.4" />
<banana id="3" color="yellow" price="0.6" />
</bananas>
<apples>
<apple id="1" color="red" price="0.5" />
<apple id="2" color="red" price="0.4" />
<apple id="3" color="green" price="0.6" />
<apple id="4" color="yellow" price="0.4" />
</apples>
<oranges>
<orange id="1" color="orange" price="0.5" />
<orange id="2" color="orange" price="0.5" />
</oranges>
</fruits>
以下のようなもの:
string xmlFilePath = "exampleWithFruits.xml";
string xPathQuery = "//fruits/apples//@color"
string[] matchingValues = interestingFunction(xmlFilePath, xPathQuery);
//for instance we would get something like : matchingValues = {red, red, green, yellow}
要約すると、 interestingFunctionなどの関数の作成方法を知りたい
どうも