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...??
Hi John,
your query contained several syntactical bugs; this one is probably what you were looking for:
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'] return $x }</Query></SH> as last into $x
Best, Christian
On 15 May 2013 10:57, John Best wrote:
Hi,
<Query>... Year <= '2013']</Query>
So you don't evaluate the content of the element Query, but you rather store the lexical representation of an XQuery query as its content. I guess this is not a bug and really what you want.
Because this is XML content as any XML content, you need to escape the '<' characters, like that:
<Query>... Year <= '2013']</Query>
Regards,
…thanks for the corrections. ___________________________
On Wed, May 15, 2013 at 12:05 PM, Florent Georges fgeorges@fgeorges.org wrote:
On 15 May 2013 10:57, John Best wrote:
Hi,
<Query>... Year <= '2013']</Query>
So you don't evaluate the content of the element Query, but you rather store the lexical representation of an XQuery query as its content. I guess this is not a bug and really what you want.
Because this is XML content as any XML content, you need to escape the '<' characters, like that:
<Query>... Year <= '2013']</Query>
Regards,
-- Florent Georges http://fgeorges.org/ http://h2oconsulting.be/ _______________________________________________ BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
basex-talk@mailman.uni-konstanz.de