gpt4 book ai didi

c# - XmlDocument.SelectSingleNode 使用哪个版本的 XPath?

转载 作者:数据小太阳 更新时间:2023-10-29 02:01:30 24 4
gpt4 key购买 nike

我正在使用 XmlDocument像这样上课:

divisionsDoc.SelectSingleNode(
string.Format(@"Root/PoliticalDivisions/PoliticalDivision[upper-case(@Code)='{0}']", withCode.ToUpper()));

这会导致错误:

Namespace Manager or XsltContext needed. This query has a prefix, variable, or user-defined function.

我想这是由于 upper-case XPath 函数,据我所知存在于 XPath 2.0 而不是 1.0(来自 herehere 等)

MSDN没有指定它使用的 XPath 版本。我的目标是 .NET 4.5.1——使用 XPath 2.0 还不够晚吗?还是在其他地方(.NET 之外)定义的东西?

我怎样才能知道目标是哪个版本的 XPath?

请注意,我知道使用 translate('some text','abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ') 的解决方法-- 这不是我要问的。

最佳答案

Microsoft 从未实现过 XPath 2.0 或 Xslt 2.0...请参阅此示例 uservoice (恰如其分地命名为 .NET 中对 XPath 2.0 或 XSLT 2.0 的 native 支持)2013 年...

2015 年 3 月一位用户的最后评论:

i guess we will never see this as the world doesn't like XML anymore, it's all about JSON. Which is a shame as XML is still far better for a number of key scenarios than JSON.

关于c# - XmlDocument.SelectSingleNode 使用哪个版本的 XPath?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30941474/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com