首页 > 解决方案 > XML短代码返回错误信息,为什么?

问题描述

我用 XML 编写了以下代码:

<# <Conditional Test= "(//Product_Name[text() = ‘LifeID3 Service’ and //Customer_Is_Paying_Maintenance/text())" /> #>

显示此文本

<# <EndConditional/> #>

不知何故,我收到以下错误消息:

(//Product_Name[text() = 'LifeID3 Service' and //Customer_Is_Paying_Maintenance/text())'有一个无效的令牌。

你能告诉我问题出在哪里吗?

标签: xmlxml-parsing

解决方案


XML 元素名称不能以 开头#,因此在格式良好的<#XML中是不允许的,因此

我用 XML 编写了以下代码:

<# <Conditional Test= "(//Product_Name[text() = ‘LifeID3 Service’ and //Customer_Is_Paying_Maintenance/text())" /> #>

不正确——那不是 XML。

但是,如果该<#构造是特定于某些(未指定)应用程序的,那么如果您修复看起来是 XPath 中的语法错误,并且谓词由)而不是关闭]

... [text() = 'LifeID3 Service' and //Customer_Is_Paying_Maintenance/text())
                                                                           ^

推荐阅读