Fwd: Error while storing "<" and "<=" in DB
missed sending to list... -- Jens Erat [phone]: tel:+49-151-56961126 [mail]: mailto:email@jenserat.de [jabber]: xmpp:jabber@jenserat.de [web]: http://www.jenserat.de PGP: 350E D9B6 9ADC 2DED F5F2 8549 CBC2 613C D745 722B Anfang der weitergeleiteten Nachricht:
Von: Jens Erat <jens.erat@uni-konstanz.de> Betreff: Aw: [basex-talk] Error while storing "<" and "<=" in DB Datum: 15. Mai 2013 11:40:29 MESZ An: John Best <johnbest5673@gmail.com>
Hi John,
as I understand your query you want to store the XQuery code in line three as text content in an XML database.
In Text nodes, the characters `<`, `>` and `&` must be escaped as entities. Either you write
for $x in /Docs/Doc where $x/Title[Desc/@name='IT' and Year >= '2010' and Year <= '2013']
or you mark the whole Query as CDATA (probably to be preferred):
for $x in Searches return insert node <SH><Id>0</Id><Date>20130515 14:05:44</Date><Query><![CDATA[ for $x in /Docs/Doc where $x/Title[Desc/@name='IT' and Year >= '2010' and Year <= '2013'] ]]></Query></SH> as last into $x
Regards from Lake Constance, Germany Jens
-- Jens Erat
[phone]: tel:+49-151-56961126 [mail]: mailto:email@jenserat.de [jabber]: xmpp:jabber@jenserat.de [web]: http://www.jenserat.de
PGP: 350E D9B6 9ADC 2DED F5F2 8549 CBC2 613C D745 722B
Am 15.05.2013 um 10:57 schrieb John Best <johnbest5673@gmail.com>:
Hi there,
I am trying to save the generated queries in database, to have a Search History.
Some of my queries have "where" conditions with < (less than) and <= (less than equal to operators.
This is the insert query -
for $x in doc('SHIST')/Searches return insert node <SH><Id>0</Id><Date>20130515 14:05:44</Date><Query> for $x in doc('Docs')/Docs/Doc where$x/Title[Desc/@name='IT' and Year >= '2010' and Year <= '2013'] </Query></SH> as last into $x
I am getting error "Expecting tag name, '<=' found
Any workaround for the same...??
-- Have a nice day JBest
_______________________________________________ BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
participants (1)
-
Jens Erat