Knowledgebase: MarkLogic Server
XQuery ampersand in string
26 May 2015 02:32 PM
The ampersand is a special character used to denote a predefined entity reference in a string literal.
XQuery W3C Recommendation
Can be found at http://www.w3.org/TR/xquery-30/ .
Section 2.4.5 'URI Literals' states "Certain characters, notably the ampersand, can only be represented using a 'predefined entity reference' or a 'character reference'."
Issues with the ampersand character
The ampersand character can be tricky to construct in an XQuery string, as it is an escape character to the XQuery parser. The ways to construct the ampersand character in XQuery are:
For additional details and examples, please refer to XML Data Model Versus Serialized XML in the MarkLogic Server's XQuery and XSLT Reference Guide.