cancel
Showing results for 
Search instead for 
Did you mean: 

How can I combine several XPath queries?

VolkerBarth
Contributor
8,657

I'd like to select several elements from a XML document and tried to combine several simple XPath queries with the pipe operator as logical OR, such as

'//GivenName | //SurName'

It seems that SQL Anywhere does not support that but raises error -892: "XPath parser error: syntax error at or before character '|'".

This is similar to that (still unanswered) FAQ on position tests in XPath queries.

Just to clarify this one: Am I right that ORing XPath expressions is not (yet) supported?

If so, are there better workarounds than

  • use a more general XPath query and filter the result set with a usual SQL WHERE clause or
  • use two openxml() calls with each single XPath query and UNION ALL both result sets?
VolkerBarth
Contributor
0 Kudos

Any more hints are still appreciated, say, by Jeff:)

Accepted Solutions (1)

Accepted Solutions (1)

jeff_albion
Advisor
Advisor

syntax error at or before character '|'

Checking the XML parser code, yes, I can confirm that '|' is not currently supported in the XPath query for OPENXML.

Any more hints are still appreciated, say, by Jeff:)

I have now made an enhancement request to look at further potential support for XPath queries in OPENXML (set operations, and boolean/comparison/set expressions) in CR #740332 for a future version of SQL Anywhere. I hope that's a more helpful hint. 😉

Answers (0)