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.
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@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è
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@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è
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è
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@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è
basex-talk@mailman.uni-konstanz.de