XQuery changes from 7.6 to 7.7

Saturday, 17 August 2013 · 3 messages · last reply 18 Aug 2013
GJ
Gerald de Jong17 Aug 2013 19:22 #
I am finding strange problems when I try using 7.7 which didn't appear before. I was building queries with XQUERY followed by \n and then the query, which worked in 7.6.
XQUERY
<Documents>
    {
        for $doc in collection('oscrtest/documents/Photograph')/Document
        order by $doc/Header/TimeStamp descending
        return $doc
    }
</Documents>
Now it warns me about the syntax of my query: "Syntax: XQUERY [query]" So then I take away the \n so that the query begins after "XQUERY " and my query becomes:
XQUERY <Documents>
    {
        for $doc in collection('oscrtest/documents/Photograph')/Document
        order by $doc/Header/TimeStamp descending
        return $doc
    }
</Documents>
upon which it reports: "[XPST0003] Expecting closing tag </Documents>." Puzzling about why this happens, I adjust the query to:
XQUERY <Documents>{
        for $doc in collection('oscrtest/documents/Photograph')/Document
        order by $doc/Header/TimeStamp descending
        return $doc
}</Documents>
but then it reports: "[XPST0003] Expecting expression." I will have to stick to 7.6 until I understand what to do about these problems. What am I missing?
-- Delving BV, Vasteland 8, Rotterdam http://www.delving.eu http://twitter.com/fluxe skype: beautifulcode +31629339805
CG
Christian Grün18 Aug 2013 00:55 #
Hi Gerald, have you been defining your commands in a BaseX command script? In that case, you’ll now have to specify your queries in a single line or (better) use the XML syntax for multi-line queries, which could e.g. read as follows:
<xquery><![CDATA[
<Documents>{
  for $doc in collection('oscrtest/documents/Photograph')/Document
  order by $doc/Header/TimeStamp descending
  return $doc
}</Documents>
]]></xquery>
Hope this helps, Christian ___________________________ 2013/8/17 Gerald de Jong <gerald at delving.eu>:
Quoted text · Gerald de Jong · 59 lines
> I am finding strange problems when I try using 7.7 which didn't appear > before. I was building queries with XQUERY followed by \n and then the > query, which worked in 7.6. > > XQUERY > <Documents> > { > for $doc in collection('oscrtest/documents/Photograph')/Document > order by $doc/Header/TimeStamp descending > return $doc > } > </Documents> > > Now it warns me about the syntax of my query: "Syntax: XQUERY [query]" > > So then I take away the \n so that the query begins after "XQUERY " and my > query becomes: > > XQUERY <Documents> > { > for $doc in collection('oscrtest/documents/Photograph')/Document > order by $doc/Header/TimeStamp descending > return $doc > } > </Documents> > > upon which it reports: > > "[XPST0003] Expecting closing tag </Documents>." > > Puzzling about why this happens, I adjust the query to: > > XQUERY <Documents>{ > for $doc in collection('oscrtest/documents/Photograph')/Document > order by $doc/Header/TimeStamp descending > return $doc > }</Documents> > > but then it reports: > > "[XPST0003] Expecting expression." > > I will have to stick to 7.6 until I understand what to do about these > problems. > > What am I missing? > > -- > Delving BV, Vasteland 8, Rotterdam > http://www.delving.eu > http://twitter.com/fluxe > skype: beautifulcode > +31629339805 > > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >
GJ
Gerald de Jong18 Aug 2013 09:00 #
Ah yes, thank you Christian. The XML syntax was what I was missing. Now I just wrap my query like this: '<xquery><![CDATA[\n'+query+'\n]]></xquery>' On Sun, Aug 18, 2013 at 12:55 AM, Christian Grün <christian.gruen at gmail.com>wrote:
Quoted text · Christian Grün · 81 lines
> Hi Gerald, > > have you been defining your commands in a BaseX command script? In > that case, you’ll now have to specify your queries in a single line or > (better) use the XML syntax for multi-line queries, which could e.g. > read as follows: > > <xquery><![CDATA[ > <Documents>{ > for $doc in collection('oscrtest/documents/Photograph')/Document > order by $doc/Header/TimeStamp descending > return $doc > }</Documents> > ]]></xquery> > > Hope this helps, > Christian > ___________________________ > > 2013/8/17 Gerald de Jong <gerald at delving.eu>: > > I am finding strange problems when I try using 7.7 which didn't appear > > before. I was building queries with XQUERY followed by \n and then the > > query, which worked in 7.6. > > > > XQUERY > > <Documents> > > { > > for $doc in collection('oscrtest/documents/Photograph')/Document > > order by $doc/Header/TimeStamp descending > > return $doc > > } > > </Documents> > > > > Now it warns me about the syntax of my query: "Syntax: XQUERY [query]" > > > > So then I take away the \n so that the query begins after "XQUERY " and > my > > query becomes: > > > > XQUERY <Documents> > > { > > for $doc in collection('oscrtest/documents/Photograph')/Document > > order by $doc/Header/TimeStamp descending > > return $doc > > } > > </Documents> > > > > upon which it reports: > > > > "[XPST0003] Expecting closing tag </Documents>." > > > > Puzzling about why this happens, I adjust the query to: > > > > XQUERY <Documents>{ > > for $doc in collection('oscrtest/documents/Photograph')/Document > > order by $doc/Header/TimeStamp descending > > return $doc > > }</Documents> > > > > but then it reports: > > > > "[XPST0003] Expecting expression." > > > > I will have to stick to 7.6 until I understand what to do about these > > problems. > > > > What am I missing? > > > > -- > > Delving BV, Vasteland 8, Rotterdam > > http://www.delving.eu > > http://twitter.com/fluxe > > skype: beautifulcode > > +31629339805 > > > > _______________________________________________ > > BaseX-Talk mailing list > > BaseX-Talk at mailman.uni-konstanz.de > > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk > > >
-- Delving BV, Vasteland 8, Rotterdam http://www.delving.eu http://twitter.com/fluxe skype: beautifulcode +31629339805

⚡Generated with XQuery