Hi all,
I can't tell if this is a bug or not.
I commented out a line in my Return clause so that I could test performance. To my surprise, the comment was interpreted as part of the literal response, and the expression within the commented line was evaluated. If this is expected behaviour, is there a workaround?
return <dup> <pii>{ $val }</pii> (: {/results/dataset/item[pii = $val]/dbpath} :) </dup>
---------------------- Result: ----------------------
<dup> <pii>0022-0728(92)80265-6</pii> (: <dbpath>SCODAT00000000001/15726657/v336i1-2/0022072892802657/main.xml</dbpath> <dbpath>SCODAT00000000002/15726657/v336i1-2/0022072892802656/main.xml</dbpath> :) </dup> <dup>
________________________________
Elsevier B.V. Registered Office: Radarweg 29, 1043 NX Amsterdam, The Netherlands, Registration No. 33156677, Registered in The Netherlands.
I commented out a line in my Return clause so that I could test performance. To my surprise, the comment was interpreted as part of the literal response, and the expression within the commented line was evaluated. If this is expected behaviour, is there a workaround?
This is expected behavior, as you may want to have smileys in your XML snippets:
<x> (: </x>
As workaround, you can either use XML comments...
<x><!-- ... --></x>
...or sth like this:
<x>{ (: ... :) () } </x>
return
<dup> <pii>{ $val }</pii>
(: {/results/dataset/item[pii = $val]/dbpath} :)
</dup>
Result:
<dup>
<pii>0022-0728(92)80265-6</pii>
(: <dbpath>SCODAT00000000001/15726657/v336i1-2/0022072892802657/main.xml</dbpath>
<dbpath>SCODAT00000000002/15726657/v336i1-2/0022072892802656/main.xml</dbpath> :)
</dup>
<dup>
Elsevier B.V. Registered Office: Radarweg 29, 1043 NX Amsterdam, The Netherlands, Registration No. 33156677, Registered in The Netherlands.
XML comments ... of course ;-)
Thanks for your incredibly fast response, Christian.
-----Original Message----- From: Christian Grün [mailto:christian.gruen@gmail.com] Sent: 09 April 2014 23:58 To: Hondros, Constantine (ELS-AMS) Cc: basex-talk@mailman.uni-konstanz.de Subject: Re: [basex-talk] XQuery comments in Return clause?
I commented out a line in my Return clause so that I could test performance. To my surprise, the comment was interpreted as part of the literal response, and the expression within the commented line was evaluated. If this is expected behaviour, is there a workaround?
This is expected behavior, as you may want to have smileys in your XML snippets:
<x> (: </x>
As workaround, you can either use XML comments...
<x><!-- ... --></x>
...or sth like this:
<x>{ (: ... :) () } </x>
return
<dup> <pii>{ $val }</pii>
(: {/results/dataset/item[pii = $val]/dbpath} :)
</dup>
Result:
<dup>
<pii>0022-0728(92)80265-6</pii>
(: <dbpath>SCODAT00000000001/15726657/v336i1-2/0022072892802657/main.xml< /dbpath>
<dbpath>SCODAT00000000002/15726657/v336i1-2/0022072892802656/main.xml< /dbpath> :)
</dup>
<dup>
Elsevier B.V. Registered Office: Radarweg 29, 1043 NX Amsterdam, The Netherlands, Registration No. 33156677, Registered in The Netherlands.
________________________________
Elsevier B.V. Registered Office: Radarweg 29, 1043 NX Amsterdam, The Netherlands, Registration No. 33156677, Registered in The Netherlands.
basex-talk@mailman.uni-konstanz.de