xml serialisation

Thursday, 12 March 2015 · 4 messages
ME
Menashè Eliezer12 Mar 2015 12:09 #
Hello, I need xquery reply which is composed of multiple values. I've chosen the xml format, but I need also the collection name of each record since I'm searching in multiple collections. However for parsing the entire reply as xml I need to add an arbitrary xml tag to base-uri($x). I couldn't find a way to do it. Any ideas? Background: I've tried first the JSON format as output:method, however it cannot be used for more than one record. I've tried text format, but I need an attribute and I get: @codeListValue cannot be serialised So, xml format provides me the option to query the attribute, even though the reply length is bigger. I'm using BaseX 8 beta.
-- With kind regards, Menashè
CG
Christian Grün12 Mar 2015 13:46 #
Hi Menashè, BaseX 8.0 and later uses the "adaptive" serialization as default [1]; maybe this gives you the freedom you need? If not, please provide us with a little example of how you would like the input to be formatted. Best, Christian [1] http://docs.basex.org/wiki/XQuery_3.1#Adaptive_Serialization
Quoted text · Menashè Eliezer · 24 lines
On Thu, Mar 12, 2015 at 12:09 PM, Menashè Eliezer <meliezer at ogs.trieste.it> wrote: > Hello, > I need xquery reply which is composed of multiple values. > I've chosen the xml format, but I need also the collection name of each > record since I'm searching in multiple collections. > However for parsing the entire reply as xml I need to add an arbitrary xml > tag to base-uri($x). > I couldn't find a way to do it. > Any ideas? > > Background: I've tried first the JSON format as output:method, however it > cannot be used for more than one record. > I've tried text format, but I need an attribute and I get: @codeListValue > cannot be serialised > So, xml format provides me the option to query the attribute, even though > the reply length is bigger. > > I'm using BaseX 8 beta. > > -- > With kind regards, > Menashè >
ML
Marco Lettere12 Mar 2015 14:07 #
Maybe something like:
for $x in db:open('mydb)
return
<collection path="{base-uri($x)}">
     {$x}
</collection>
optionally, if you want everything included to become a unique XML element:
<global>{
for $x in db:open('mydb)
return
<collection path="{base-uri($x)}">
     {$x}
</collection>
}</global>
Hope I understood your question correctly... M.
Quoted text · Christian Grün · 37 lines
On 12/03/2015 13:46, Christian Grün wrote: > Hi Menashè, > > BaseX 8.0 and later uses the "adaptive" serialization as default [1]; > maybe this gives you the freedom you need? If not, please provide us > with a little example of how you would like the input to be formatted. > > Best, > Christian > > [1] http://docs.basex.org/wiki/XQuery_3.1#Adaptive_Serialization > > > On Thu, Mar 12, 2015 at 12:09 PM, Menashè Eliezer > <meliezer at ogs.trieste.it> wrote: >> Hello, >> I need xquery reply which is composed of multiple values. >> I've chosen the xml format, but I need also the collection name of each >> record since I'm searching in multiple collections. >> However for parsing the entire reply as xml I need to add an arbitrary xml >> tag to base-uri($x). >> I couldn't find a way to do it. >> Any ideas? >> >> Background: I've tried first the JSON format as output:method, however it >> cannot be used for more than one record. >> I've tried text format, but I need an attribute and I get: @codeListValue >> cannot be serialised >> So, xml format provides me the option to query the attribute, even though >> the reply length is bigger. >> >> I'm using BaseX 8 beta. >> >> -- >> With kind regards, >> Menashè >>
ME
Menashè Eliezer12 Mar 2015 14:36 #
Great! Now I'm able to create a perfectly clean and customised xml result freely using @codeListValue, /text(), string(), etc. I've also added string handling so I already have the name of the collection: <collection name="{substring-before(base-uri($x),'/')}"> Thank you Marco! With kind regards, Menashè
Quoted text · Marco Lettere · 66 lines
On 03/12/2015 02:07 PM, Marco Lettere wrote: > > Maybe something like: > > for $x in db:open('mydb) > return > <collection path="{base-uri($x)}"> > {$x} > </collection> > > optionally, if you want everything included to become a unique XML > element: > > <global>{ > for $x in db:open('mydb) > return > <collection path="{base-uri($x)}"> > {$x} > </collection> > }</global> > > Hope I understood your question correctly... > M. > > > On 12/03/2015 13:46, Christian Grün wrote: >> Hi Menashè, >> >> BaseX 8.0 and later uses the "adaptive" serialization as default [1]; >> maybe this gives you the freedom you need? If not, please provide us >> with a little example of how you would like the input to be formatted. >> >> Best, >> Christian >> >> [1] http://docs.basex.org/wiki/XQuery_3.1#Adaptive_Serialization >> >> >> On Thu, Mar 12, 2015 at 12:09 PM, Menashè Eliezer >> <meliezer at ogs.trieste.it> wrote: >>> Hello, >>> I need xquery reply which is composed of multiple values. >>> I've chosen the xml format, but I need also the collection name of each >>> record since I'm searching in multiple collections. >>> However for parsing the entire reply as xml I need to add an >>> arbitrary xml >>> tag to base-uri($x). >>> I couldn't find a way to do it. >>> Any ideas? >>> >>> Background: I've tried first the JSON format as output:method, >>> however it >>> cannot be used for more than one record. >>> I've tried text format, but I need an attribute and I get: >>> @codeListValue >>> cannot be serialised >>> So, xml format provides me the option to query the attribute, even >>> though >>> the reply length is bigger. >>> >>> I'm using BaseX 8 beta. >>> >>> -- >>> With kind regards, >>> Menashè >>>

⚡Generated with XQuery