Changes

Jump to navigation Jump to search
1 byte added ,  15:21, 30 October 2014
no edit summary
The syntax makes nested function calls more readable, as it is easy to see if parentheses are balanced.
 
==JSON Serialization==
 
{{Mark|Warning}}: BaseX has been using the {{Code|json}} output method for a while. With BaseX 8.0, the implementation of this method has been rewritten to comply with the new standard serialization rules and, at the same time, to preserve the existing semantics:
 
* If an XML node of type {{Code|element(json)}} is found, it will be serialized following the serialization rules of the [[JSON Module]].
* Any other node or atomic value, map, array, or empty sequence will be serialized according to the [http://www.w3.org/TR/xslt-xquery-serialization-31/ Official Specification].
 
The following two queries will both return the JSON snippet <code>{ "key": "value" }</code>:
 
<pre class="brush:xquery">
declare option output:method 'json';
map { "key": "value" }
</pre>
 
<pre class="brush:xquery">
declare option output:method 'json';
<json type='object'>
<key>value</key>
</json>
</pre>
==Functions==
<pre class="brush:xquery">
json-doc("http://ip.jsontest.com/")('ip') (: returns your IP address :)
</pre>
 
====Serialization====
 
{{Mark|Warning}}: BaseX has been using the {{Code|json}} output method for a while. With BaseX 8.0, the implementation of this method has been rewritten to comply with the new standard serialization rules and, at the same time, to preserve the existing semantics:
 
* If an XML node of type {{Code|element(json)}} is found, it will be serialized following the serialization rules of the [[JSON Module]].
* Any other node or atomic value, map, array, or empty sequence will be serialized according to the [http://www.w3.org/TR/xslt-xquery-serialization-31/ Official Specification].
 
The following two queries will both return the JSON snippet <code>{ "key": "value" }</code>:
 
<pre class="brush:xquery">
declare option output:method 'json';
map { "key": "value" }
</pre>
 
<pre class="brush:xquery">
declare option output:method 'json';
<json type='object'>
<key>value</key>
</json>
</pre>
Bureaucrats, editor, reviewer, Administrators
13,554

edits

Navigation menu