首页 > 解决方案 > 读取 XML 没有结果

问题描述

我正在尝试枚举此 xml(示例):

<SearchSuggestion xmlns="http://opensearch.org/searchsuggest2" version="2.0">
   <Query xml:space="preserve">Relativity</Query>
   <Section>
    <Item>
        <Text xml:space="preserve">Relativity</Text>
        <Url xml:space="preserve">https://en.wikipedia.org/wiki/Relativity</Url>
    </Item>
    <Item>
        <Text xml:space="preserve">Relativity priority dispute</Text>
        <Url xml:space="preserve">https://en.wikipedia.org/wiki/Relativity_priority_dispute</Url>
    </Item>
....

使用:

XmlNodeList nItems = rssDoc.SelectNodes("/SearchSuggestion/Section/Item")

但它没有产生任何结果。谁能告诉我为什么?

标签: c#.netxml

解决方案


推荐阅读