XQuery XmlSpy删除

时间:2013-04-14 11:33:02

标签: xml xquery altova xmlspy

我正在尝试使用Altova XMLSpy中的in-build XQuery编译器通过XQuery删除XML节点。

xquery version "1.0" encoding "UTF-8";
for $customer in doc("Customers.xml")/dataroot/Customers
where $customer/CustomerID = "ALFKI"
return delete node $customer;

问题是编译器没有将“删除节点”视为有效语法,而是在此处定义:http://www.w3.org/TR/xquery-update-10/

它抱怨错误“意外的令牌节点$ customer”。

有什么想法吗?

2 个答案:

答案 0 :(得分:2)

事实是XMLSpy不支持XQuery Update Facility,因此delete关键字无效

答案 1 :(得分:1)

$customer之后删除错失的分号。

xquery version "1.0" encoding "UTF-8";
for $customer in doc("Customers.xml")/dataroot/Customers
where $customer/CustomerID = "ALFKI"
return delete node $customer (: here was the semicolon :)

否则,您的XQuery有效。