xmlファイルを解析しようとしています
私のコードは次のようになります:
string path2 = "xmlFile.xml";
XmlDocument xDoc = new XmlDocument();
xDoc.Load(path2);
XmlNodeList xnList = xDoc.DocumentElement["feed"].SelectNodes("entry");
しかし、ノードのリストを取得できないようです。「'new'キーワードを使用してオブジェクトインスタンスを作成してください」というエラーメッセージが表示されます。'SelectNodes( "entry")'にあるようですこのコードは、ローカルファイルではなくrssフィードからxmlをロードしたときに機能しました。私が間違っていることを教えてもらえますか?
私のxmlは次のようになります:
<?xml version="1.0"?>
<feed xmlns:media="http://search.yahoo.com/mrss/" xmlns:gr="http://www.google.com/schemas/reader/atom/" xmlns:idx="urn:atom-extension:indexing" xmlns="http://www.w3.org/2005/Atom" idx:index="no" gr:dir="ltr">
<entry gr:crawl-timestamp-msec="1318667375230">
<title type="html">Title 1 text</title>
<summary>summary 1 text text text</summary>
</entry>
<entry gr:crawl-timestamp-msec="1318667375230">
<title type="html">title 2 text</title>
<summary>summary 2 text text text</summary>
</entry>
</feed>