Hi,
I am wondering why xs:string("&") is not possible, but xs:string("<") is (although XML does not allow both ). Is there any reason? Thanks.
Best, Giuseppe
Am 25.08.2019 um 14:16 schrieb Giuseppe G. A. Celano:
I am wondering why xs:string("&") is not possible, but xs:string("<") is (although XML does not allow both ). Is there any reason? Thanks.
You are allowed to use some predefined entity references and to use character references in string literals, see https://www.w3.org/TR/xquery-31/#prod-xquery31-StringLiteral which defines
[222] StringLiteral ::= ('"' (PredefinedEntityRef | CharRef | EscapeQuot | [^"&])* '"') | ("'" (PredefinedEntityRef | CharRef | EscapeApos | [^'&])* "'")
so you can use the ampersand as a meta character for e.g. `<` and e.g. ` `, on the other hand, to use it literally, you need some escape mechanism in the form of `&`.
Inside XML the angle brackets are needed for markup but that is not the case inside of a string literal so you can use them freely in there.
Thanks!
On Aug 25, 2019, at 2:26 PM, Martin Honnen martin.honnen@gmx.de wrote:
Am 25.08.2019 um 14:16 schrieb Giuseppe G. A. Celano:
I am wondering why xs:string("&") is not possible, but xs:string("<") is (although XML does not allow both ). Is there any reason? Thanks.
You are allowed to use some predefined entity references and to use character references in string literals, see https://www.w3.org/TR/xquery-31/#prod-xquery31-StringLiteral https://www.w3.org/TR/xquery-31/#prod-xquery31-StringLiteral which defines [222] StringLiteral ::= ('"' (PredefinedEntityRef | CharRef | EscapeQuot | [^"&])* '"') | ("'" (PredefinedEntityRef | CharRef | EscapeApos | [^'&])* "'")
so you can use the ampersand as a meta character for e.g. `<` and e.g. ` `, on the other hand, to use it literally, you need some escape mechanism in the form of `&`.
Inside XML the angle brackets are needed for markup but that is not the case inside of a string literal so you can use them freely in there.
basex-talk@mailman.uni-konstanz.de