在查询字符串中索引XML节点 [英] Indexing XML Nodes in Query String

查看:84
本文介绍了在查询字符串中索引XML节点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否有一种方法可以索引查询字符串中的节点,用于获取所需节点的路径,因为我需要获取特定节点的属性,但无法解决如何执行此操作。



所有节点都相同,但我想获得第5个节点。



I was wondering if there is a way to index nodes inside the query string you use to get the path to the node you want as I need to get an attribute of a specific node but can't work out how to do this.

All the nodes are the same but I want to get the 5th one.

if (DataDoc.SelectNodes("/SiteRep/DV/Location/Period/Rep/@T")[6] != null)

索引^

我想获得第5个Rep节点,但它们都以Rep开头,所以如何在字符串中对它们进行索引。谢谢你

index^
I want to get the 5th Rep node but they are all begin with Rep so how can I index them inside the string. Thank you

推荐答案

你很接近,只需将索引放在路径中:

You're close, just put the index in the path:
if (DataDoc.SelectNodes("/SiteRep/DV/Location/Period/Rep[5]/@T") != null)


这篇关于在查询字符串中索引XML节点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆