var xml= @"<?xml version='1.0'?>
<bookstore>
<book genre=""3"">
<title>The Gorgias3</title>
<author>
<name>Plato3</name>
</author>
<price>3</price>
</book>
<book genre=""4"">
<title>The Gorgias4</title>
<author>
<name>Plato4</name>
</author>
<price>4</price>
</book>
</bookstore>";
XPathDocument docNav = new XPathDocument(new StringReader(xml));
XPathNavigator navigator = docNav.CreateNavigator();
XPathNodeIterator NodeIter = navigator.Select("/bookstore/book/title");
foreach (XPathNavigator selectedNode in NodeIter)
{
Console.WriteLine(selectedNode.Name);
}
/bookstore/book/title"
最初の子に直接アクセスして値を取得するにはどうすればよいですか。
繰り返してループを壊したくない
結果は"The Gorgias3"
ps 最初のフィルターで xpath 式を変更したくありません。
c# でそれを行う方法を知りたいです。