MarkLogic 10 and Data Hub 5.0

Latest MarkLogic releases provide a smarter, simpler, and more secure way to integrate data.

Read Blog →


Stay On Top Of Everything MarkLogic

Be the first to know! News, product information, and events delivered straight to your inbox.

Sign Me Up →

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 .

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'."

Section 3.1.1 'Literals' defines the predefined entity reference for ampersand as "&".

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.

(4 vote(s))
Not helpful

Comments (0)