【问题标题】:classic asp not recognizing xPath contains() function经典的 asp 无法识别 xPath contains() 函数
【发布时间】:2011-11-02 20:07:42
【问题描述】:

我正在使用经典的 ASP、XML 和 xPath 来选择一些数据,并且我正在尝试在节点 id_attribut 包含“xc”的以下 xml 上进行选择。所以我只想选择前 2 个属性。

我的 xpath 是:

"//attribut[contains(id_attribut,"xc")]"

但是 ASP 给了我错误:

msxml3.dll 错误“80004005”未知方法。 //属性[-->包含(id_attribut

对于经典 ASP(不是 ASP.net)中的 xPath,contains() 不是一个有效的函数吗?

我有以下 XML:

<attributes>    
<attribut>
     <id_attribut>xc_elite</id_attribut>
     <level>4</level>
     <pty>1</pty>
     <parent>xc</parent>
   </attribut>
<attribut>
     <id_attribut>xc_performance</id_attribut>
     <level>4</level>
     <pty>2</pty>
     <parent>xc</parent>
</attribut>
<attribut>
     <id_attribut>alp_elite</id_attribut>
     <level>4</level>
     <pty>1</pty>
     <parent>alp</parent>
</attribut>
</attributes>

感谢您的帮助!!

【问题讨论】:

  • 尝试时会发生什么://attribut[starts-with(id_attribut,"xc")]
  • 这不是 ASP 错误 - 看起来像 XML 错误。
  • 一行实际的 VBScript 代码可以改善这个问题。

标签: xml xpath asp-classic


【解决方案1】:

MSXML3 以其错误消息的质量而闻名 - 尝试使用不同的处理器对其进行编译以获得更好的诊断。

我怀疑问题在于您在第二个参数周围使用了未转义的引号。如果使用双引号作为属性分隔符,则必须在 XPath 表达式中的字符串文字周围使用单引号。

【讨论】:

  • 是的,很抱歉。引号实际上在我的代码中被转义,我不确定为什么它们没有粘贴到我的消息代码块中。在此之前,我已经能够在我的所有其他 xPath 中使用转义双引号。
猜你喜欢
  • 1970-01-01
  • 2022-01-06
  • 1970-01-01
  • 1970-01-01
  • 2021-12-08
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多