Hi Erol and others.
1. Description, how to use existing Java functions as XQuery ones is here: http://docs.basex.org/wiki/Java_Bindings 2. Old thread about JSON is here: https://mailman.uni-konstanz.de/pipermail/basex-talk/2011-January/001076.htm... 3. I was comparing different formats for load and parsing time and I was really surprised, how effective JSON format is in this regard. So providing the data in JSON format is likely to be more effective for your (Erol) use case.
And thanks to Michael for pointing to JSON implementation for Java.
Jan
2011/5/13 Erol Akarsu eakarsu@gmail.com
Jan,
Thanks for sharing your experience.
I am thinking to use Basex as database for product/services catalog and show them in html document. I think jquery will be more comfortable with json input that is also lightweight.
I did not compare the complexity of parsing xml and json. Do you have any experience?
Thanks
Erol Akarsu
On Fri, May 13, 2011 at 9:33 AM, Jan Vlčinský (CAD) < jan.vlcinsky@cad-programs.com> wrote:
Hi Erol I had exactly the same question some time ago. As far as I know, BaseX does not have "native" JSON output supported. I was advised to use either some generic XSLT transformation, which converts XML into JSON, or use some Java library, which is supporting this and can be optionally called as imported function (I do not remembter which one, try searching archive or finding your own - there used to be some instruction how to use functions from jar archives as XQuery ones, but I have always problems finding this).
My real life project ended up with writting my own XQuery, generating text output. Any approach is making some assumptions and you easily find, that some parts of your system do not fit. My task was to generate json output, being usable for SIMILE framework and I had to follow the JSON structure, which SIMILE was expecting.
Good luck
Jan
*Ing. Jan Vlčinský* CAD programy Slunečnicová 338/3, 734 01 Karviná Ráj, Czech Republic tel: +420-597 602 024; mob: +420-608 979 040 skype: janvlcinsky; GoogleTalk: jan.vlcinsky@gmail.com http://cz.linkedin.com/in/vlcinsky
2011/5/13 Erol Akarsu eakarsu@gmail.com
Is there a way Basex server can send us JSON output instead of xml?