Tag: choicesinglenode

为什么SelectSingleNode返回null?

我正在使用包含类似于此的结构的XML文档: . . . 我正在以这种方式将文件从文件加载到XML文档中: XmlDocument xdoc = new XmlDocument(); xdoc.Load(“somefile.xml”); //Successfully loads btw 但是,当我尝试运行下一行代码时,我遇到了一个问题,只有这个特定的文档: xdoc.SelectSingleNode(“//event[@id=’1′]”); //This returns a null 我是否在正确的轨道上猜测这是因为使用名为’id’的属性的问题或者我在代码中遗漏了某些东西而返回null?