avatar
一个xml的问题。# DotNet - 窗口里的风景
k*e
1
看xml版很萧条,就放在这里了,hoho。
in xml file, how to easily access a particular node?
in other words, is there to uniquely identify a node(in c#)?
I remember there is a position() function in xsl, don't
know if it works this way.
for example, we can easily access an object in an array
by the index. is there any similar thing in xml? (maybe
just use SelectNodes to select nodes and use index? )
avatar
p*n
2
there are more than 1 way to do it in C# but one of them is
XPathNavigator.Select Method (XPathExpression)
using namespace System::Xml;
using namespace System::Xml::XPath;
if you know the node's exact XPath,

【在 k***e 的大作中提到】
: 看xml版很萧条,就放在这里了,hoho。
: in xml file, how to easily access a particular node?
: in other words, is there to uniquely identify a node(in c#)?
: I remember there is a position() function in xsl, don't
: know if it works this way.
: for example, we can easily access an object in an array
: by the index. is there any similar thing in xml? (maybe
: just use SelectNodes to select nodes and use index? )

avatar
s*i
3
check out XmlDocument

【在 k***e 的大作中提到】
: 看xml版很萧条,就放在这里了,hoho。
: in xml file, how to easily access a particular node?
: in other words, is there to uniquely identify a node(in c#)?
: I remember there is a position() function in xsl, don't
: know if it works this way.
: for example, we can easily access an object in an array
: by the index. is there any similar thing in xml? (maybe
: just use SelectNodes to select nodes and use index? )

avatar
a*y
4
Use an unique ID as an attribute,
use SelectNodes("//NodeName[@ID='blah']");
This way, it will recursively search for all the nodes under current node.

【在 k***e 的大作中提到】
: 看xml版很萧条,就放在这里了,hoho。
: in xml file, how to easily access a particular node?
: in other words, is there to uniquely identify a node(in c#)?
: I remember there is a position() function in xsl, don't
: know if it works this way.
: for example, we can easily access an object in an array
: by the index. is there any similar thing in xml? (maybe
: just use SelectNodes to select nodes and use index? )

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。