0

I'm attempting to delete an XML node through XQuery using the in-build XQuery compiler in Altova XMLSpy.

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

The issue is the compiler doesn't see 'delete node' as valid syntax, whereas it's defined here: http://www.w3.org/TR/xquery-update-10/

It complains with an error "Unexpected token node $customer".

Any ideas?

2 Answers2

2

the fact is that XMLSpy don't support XQuery Update Facility, hence the delete keyword is not valid

Babas
  • 21
  • 2
1

Remove the missplaced semicolon after $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 :)

Otherwise, your XQuery is valid.

Jens Erat
  • 37,523
  • 16
  • 80
  • 96