C# 复杂文档的XPath
我有以下xml文档,我需要选择components/section/templateid=3.11的所有条目节点。XPath应该是什么C# 复杂文档的XPath,c#,xml,xpath,C#,Xml,Xpath,我有以下xml文档,我需要选择components/section/templateid=3.11的所有条目节点。XPath应该是什么 <component> <structuredBody> <component> <section> <templateId root="1.11"/>
<component>
<structuredBody>
<component>
<section>
<templateId root="1.11"/>
<entry>......</entry>
</section>
</component>
<component>
<section>
<templateId root="2.11"/>
<templateId root="2.12"/>
<entry>......</entry>
<entry>......</entry>
</section>
</component>
<component>
<section>
<templateId root="3.11"/>
<templateId root="3.12"/>
<entry>......</entry>
<entry>......</entry>
</section>
</component>
<structuredBody>
</component>
......
......
......
......
......
这是否适合您的需要
//component/section/templateId[@root='3.11']/following-sibling::entry
我试过了,但它没有返回任何内容。很抱歉,我忘了提一下我应该在其中添加名称空间吗?你能给我提供一些链接,我可以从中获得复杂的XPath示例列表吗?@user1649941:我不会把这一个称为“复杂的”,因为还有一些更复杂的示例丢失了。这是一个很好的起点,尤其是。在线Xpath测试人员也会很有帮助,比如。