inserting ampersand

Tuesday, 23 April 2013 · 2 messages
MF
marco fregonese23 Apr 2013 00:51 #
Hi there, I have the following xquery function:
*declare updating function local:insert ($a)
{
insert node <title>{$a}</title> into /web
};
local:insert ("&")* but if I try to insert an apersand, basex says "invalid entity '&' ". So, my question: is there any way to insert an ampersand? Thank you.
BC
Ben Companjen23 Apr 2013 01:37 #
Ampersands have a special meaning in XML, namely to start "entities" that are strings starting with '&' and ending with ';' (a semicolon). Some entities are used as abbreviations (e.g. namespaces in places where a QName is not allowed), others as escaped versions of special XML characters like '&', '<', '>' (and, eh, others?) The escaped ampersand is '&amp;' (without quotes). I am pretty sure that should work. Ben
Quoted text · marco fregonese · 23 lines
On 23 April 2013 00:51, marco fregonese <marcofregonese at gmail.com> wrote: > Hi there, > > I have the following xquery function: > > declare updating function local:insert ($a) > { > insert node <title>{$a}</title> into /web > }; > > local:insert ("&") > > but if I try to insert an apersand, basex says "invalid entity '&' ". > > So, my question: is there any way to insert an ampersand? > > Thank you. > > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >

⚡Generated with XQuery