Merge lp:~zorba-coders/zorba/bug-1189786-json-update into lp:zorba

Proposed by Chris Hillery
Status: Merged
Approved by: Paul J. Lucas
Approved revision: 11553
Merged at revision: 11550
Proposed branch: lp:~zorba-coders/zorba/bug-1189786-json-update
Merge into: lp:zorba
Diff against target: 1898 lines (+333/-480)
79 files modified
modules/CMakeLists.txt (+1/-0)
modules/com/zorba-xquery/www/modules/CMakeLists.txt (+0/-4)
modules/com/zorba-xquery/www/modules/converters/json-options.xsd (+0/-60)
modules/json/CMakeLists.txt (+16/-0)
modules/json/json-xml.xq (+22/-57)
src/context/static_context.cpp (+1/-1)
src/functions/pregenerated/func_json.cpp (+10/-10)
src/functions/pregenerated/func_json.h (+6/-6)
src/functions/pregenerated/function_enum.h (+2/-2)
src/runtime/json/json_impl.cpp (+9/-14)
src/runtime/json/pregenerated/json.cpp (+54/-54)
src/runtime/json/pregenerated/json.h (+14/-14)
src/runtime/pregenerated/iterator_enum.h (+2/-2)
src/runtime/spec/json/json.xml (+4/-4)
src/runtime/spec/mappings.xml (+1/-1)
src/runtime/visitors/pregenerated/planiter_visitor.h (+6/-6)
src/runtime/visitors/pregenerated/printer_visitor.cpp (+26/-26)
src/runtime/visitors/pregenerated/printer_visitor.h (+4/-4)
test/rbkt/Queries/CMakeLists.txt (+1/-0)
test/rbkt/Queries/zorba/error/data-location-json-2.xq (+2/-2)
test/rbkt/Queries/zorba/json/json-invalid-option-parameter.xq (+4/-8)
test/rbkt/Queries/zorba/json/json-jsonml_array-parse-01.xq (+3/-6)
test/rbkt/Queries/zorba/json/json-jsonml_array-parse-02.xq (+3/-6)
test/rbkt/Queries/zorba/json/json-jsonml_array-parse-03.xq (+3/-6)
test/rbkt/Queries/zorba/json/json-jsonml_array-parse-04.xq (+3/-6)
test/rbkt/Queries/zorba/json/json-jsonml_array-parse-05.xq (+3/-6)
test/rbkt/Queries/zorba/json/json-jsonml_array-parse-06.xq (+3/-6)
test/rbkt/Queries/zorba/json/json-jsonml_array-parse-07.xq (+4/-7)
test/rbkt/Queries/zorba/json/json-jsonml_array-parse-08.xq (+4/-7)
test/rbkt/Queries/zorba/json/json-jsonml_array-parse-wikipedia.xq (+3/-6)
test/rbkt/Queries/zorba/json/json-jsonml_array-serialize-01.xq (+3/-6)
test/rbkt/Queries/zorba/json/json-jsonml_array-serialize-02.xq (+3/-6)
test/rbkt/Queries/zorba/json/json-jsonml_array-serialize-03.xq (+3/-6)
test/rbkt/Queries/zorba/json/json-jsonml_array-serialize-indent-wikipedia.xq (+3/-7)
test/rbkt/Queries/zorba/json/json-jsonml_array-serialize-none-wikipedia.xq (+3/-6)
test/rbkt/Queries/zorba/json/json-jsonml_array-serialize-some-wikipedia.xq (+3/-7)
test/rbkt/Queries/zorba/json/json-snelson-invalid-json.xq (+2/-2)
test/rbkt/Queries/zorba/json/json-snelson-parse-array-01.xq (+2/-2)
test/rbkt/Queries/zorba/json/json-snelson-parse-array-02.xq (+2/-2)
test/rbkt/Queries/zorba/json/json-snelson-parse-array-03.xq (+2/-2)
test/rbkt/Queries/zorba/json/json-snelson-parse-array-04.xq (+2/-2)
test/rbkt/Queries/zorba/json/json-snelson-parse-array-05.xq (+2/-2)
test/rbkt/Queries/zorba/json/json-snelson-parse-array-06.xq (+2/-2)
test/rbkt/Queries/zorba/json/json-snelson-parse-array-07.xq (+2/-2)
test/rbkt/Queries/zorba/json/json-snelson-parse-array-08.xq (+3/-3)
test/rbkt/Queries/zorba/json/json-snelson-parse-empty.xq (+2/-2)
test/rbkt/Queries/zorba/json/json-snelson-parse-example.xq (+2/-2)
test/rbkt/Queries/zorba/json/json-snelson-parse-numbers.xq (+5/-5)
test/rbkt/Queries/zorba/json/json-snelson-parse-object-01.xq (+2/-2)
test/rbkt/Queries/zorba/json/json-snelson-parse-object-02.xq (+2/-2)
test/rbkt/Queries/zorba/json/json-snelson-parse-object-03.xq (+3/-3)
test/rbkt/Queries/zorba/json/json-snelson-parse-object-04.xq (+3/-3)
test/rbkt/Queries/zorba/json/json-snelson-parse-object-05.xq (+5/-5)
test/rbkt/Queries/zorba/json/json-snelson-parse-serialize.xq (+2/-2)
test/rbkt/Queries/zorba/json/json-snelson-parse-uncommon-chars.xq (+5/-5)
test/rbkt/Queries/zorba/json/json-snelson-parse-utf8-01.xq (+2/-2)
test/rbkt/Queries/zorba/json/json-snelson-serialize-array-01.xq (+2/-2)
test/rbkt/Queries/zorba/json/json-snelson-serialize-array-02.xq (+2/-2)
test/rbkt/Queries/zorba/json/json-snelson-serialize-array-03.xq (+2/-2)
test/rbkt/Queries/zorba/json/json-snelson-serialize-array-04.xq (+2/-2)
test/rbkt/Queries/zorba/json/json-snelson-serialize-array-05.xq (+2/-2)
test/rbkt/Queries/zorba/json/json-snelson-serialize-array-06.xq (+2/-2)
test/rbkt/Queries/zorba/json/json-snelson-serialize-array-07.xq (+2/-2)
test/rbkt/Queries/zorba/json/json-snelson-serialize-array-08.xq (+2/-2)
test/rbkt/Queries/zorba/json/json-snelson-serialize-array-09.xq (+2/-2)
test/rbkt/Queries/zorba/json/json-snelson-serialize-array-10.xq (+2/-2)
test/rbkt/Queries/zorba/json/json-snelson-serialize-array-11.xq (+2/-2)
test/rbkt/Queries/zorba/json/json-snelson-serialize-array-12.xq (+2/-2)
test/rbkt/Queries/zorba/json/json-snelson-serialize-comment-node.xq (+2/-2)
test/rbkt/Queries/zorba/json/json-snelson-serialize-indent-example.xq (+3/-7)
test/rbkt/Queries/zorba/json/json-snelson-serialize-invalid-value-for-attribute.xq (+2/-2)
test/rbkt/Queries/zorba/json/json-snelson-serialize-none-example.xq (+2/-2)
test/rbkt/Queries/zorba/json/json-snelson-serialize-object-01.xq (+2/-2)
test/rbkt/Queries/zorba/json/json-snelson-serialize-object-02.xq (+2/-2)
test/rbkt/Queries/zorba/json/json-snelson-serialize-object-03.xq (+2/-2)
test/rbkt/Queries/zorba/json/json-snelson-serialize-parse.xq (+2/-2)
test/rbkt/Queries/zorba/json/json-snelson-serialize-some-example.xq (+3/-7)
test/rbkt/Queries/zorba/json/json-snelson-serialize-type-value-missing.xq (+2/-2)
test/update/Queries/zorba/store/sc3_ex3.xq (+3/-5)
To merge this branch: bzr merge lp:~zorba-coders/zorba/bug-1189786-json-update
Reviewer Review Type Date Requested Status
Paul J. Lucas Approve
Chris Hillery Approve
Review via email: mp+174085@code.launchpad.net

Commit message

Update "JSON" module: now known as "json-xml", function names changed, namespace changed to zorba.io, moved out of unnecessary subdirectories.

To post a comment you must log in.
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue result for https://code.launchpad.net/~zorba-coders/zorba/bug-1189786-json-update/+merge/174085

Stage "ZorbaVQ" failed.

Check console output at http://jenkins.lambda.nu/job/ZorbaVQ/94/console to view the results.

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue result for https://code.launchpad.net/~zorba-coders/zorba/bug-1189786-json-update/+merge/174085

Stage "ZorbaVQ" failed.

Check console output at http://jenkins.lambda.nu/job/ZorbaVQ/95/console to view the results.

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue result for https://code.launchpad.net/~zorba-coders/zorba/bug-1189786-json-update/+merge/174085

Stage "ZorbaVQ" failed.

Check console output at http://jenkins.lambda.nu/job/ZorbaVQ/96/console to view the results.

11552. By Chris Hillery

Merge from trunk.

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue result for https://code.launchpad.net/~zorba-coders/zorba/bug-1189786-json-update/+merge/174085

Stage "TestZorbaUbuntu" failed.
3 tests failed (8345 total tests run).

Check test results at http://jenkins.lambda.nu/job/TestZorbaUbuntu/67/testReport/ to view the results.

11553. By Chris Hillery

Fixing a few last tests.

Revision history for this message
Chris Hillery (ceejatec) :
review: Approve
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Voting criteria failed for the following merge proposals:

https://code.launchpad.net/~zorba-coders/zorba/bug-1189786-json-update/+merge/174085 :
Votes: {'Approve': 1, 'Pending': 1, 'Needs commit message': 1}

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue result for https://code.launchpad.net/~zorba-coders/zorba/bug-1189786-json-update/+merge/174085

Stage "CommitZorba" failed.

Check console output at http://jenkins.lambda.nu/job/CommitZorba/21/console to view the results.

Revision history for this message
Paul J. Lucas (paul-lucas) :
review: Approve
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue succeeded - proposal merged!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'modules/CMakeLists.txt'
--- modules/CMakeLists.txt 2013-07-04 22:17:19 +0000
+++ modules/CMakeLists.txt 2013-07-11 06:16:30 +0000
@@ -18,6 +18,7 @@
18ADD_SUBDIRECTORY(xqxq)18ADD_SUBDIRECTORY(xqxq)
19ADD_SUBDIRECTORY(w3c)19ADD_SUBDIRECTORY(w3c)
20ADD_SUBDIRECTORY(full-text)20ADD_SUBDIRECTORY(full-text)
21ADD_SUBDIRECTORY(json)
21ADD_SUBDIRECTORY(nodes)22ADD_SUBDIRECTORY(nodes)
2223
23# Add external module projects - any subdirectories of a directory24# Add external module projects - any subdirectories of a directory
2425
=== modified file 'modules/com/zorba-xquery/www/modules/CMakeLists.txt'
--- modules/com/zorba-xquery/www/modules/CMakeLists.txt 2013-07-04 22:17:19 +0000
+++ modules/com/zorba-xquery/www/modules/CMakeLists.txt 2013-07-11 06:16:30 +0000
@@ -88,10 +88,6 @@
88# Subdirectories88# Subdirectories
89DECLARE_ZORBA_MODULE(FILE converters/base64.xq VERSION 2.089DECLARE_ZORBA_MODULE(FILE converters/base64.xq VERSION 2.0
90 URI "http://www.zorba-xquery.com/modules/converters/base64")90 URI "http://www.zorba-xquery.com/modules/converters/base64")
91DECLARE_ZORBA_MODULE(FILE converters/json.xq VERSION 2.0
92 URI "http://www.zorba-xquery.com/modules/converters/json")
93DECLARE_ZORBA_SCHEMA(FILE converters/json-options.xsd
94 URI "http://www.zorba-xquery.com/modules/converters/json-options")
95DECLARE_ZORBA_MODULE(FILE introspection/sctx.xq VERSION 2.091DECLARE_ZORBA_MODULE(FILE introspection/sctx.xq VERSION 2.0
96 URI "http://www.zorba-xquery.com/modules/introspection/sctx")92 URI "http://www.zorba-xquery.com/modules/introspection/sctx")
9793
9894
=== removed file 'modules/com/zorba-xquery/www/modules/converters/json-options.xsd'
--- modules/com/zorba-xquery/www/modules/converters/json-options.xsd 2013-02-07 17:24:36 +0000
+++ modules/com/zorba-xquery/www/modules/converters/json-options.xsd 1970-01-01 00:00:00 +0000
@@ -1,60 +0,0 @@
1<!--
2 ! Copyright 2006-2008 The FLWOR Foundation.
3 !
4 ! Licensed under the Apache License, Version 2.0 (the "License");
5 ! you may not use this file except in compliance with the License.
6 ! You may obtain a copy of the License at
7 !
8 ! http://www.apache.org/licenses/LICENSE-2.0
9 !
10 ! Unless required by applicable law or agreed to in writing, software
11 ! distributed under the License is distributed on an "AS IS" BASIS,
12 ! WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 ! See the License for the specific language governing permissions and
14 ! limitations under the License.
15-->
16
17<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
18 xmlns:json="http://www.zorba-xquery.com/modules/converters/json-options"
19 targetNamespace="http://www.zorba-xquery.com/modules/converters/json-options"
20 elementFormDefault="qualified"
21 attributeFormDefault="unqualified">
22
23 <xs:element name="options">
24 <xs:complexType>
25 <xs:all>
26
27 <xs:element name="json-format" minOccurs="1" maxOccurs="1">
28 <xs:complexType>
29 <xs:attribute name="value" use="required">
30 <xs:simpleType>
31 <xs:restriction base="xs:string">
32 <xs:enumeration value="Snelson"/>
33 <xs:enumeration value="JsonML-array"/>
34 <!-- <xs:enumeration value="JsonML-object"/> -->
35 </xs:restriction>
36 </xs:simpleType>
37 </xs:attribute>
38 </xs:complexType>
39 </xs:element>
40
41 <xs:element name="whitespace" minOccurs="0" maxOccurs="1">
42 <xs:complexType>
43 <xs:attribute name="value" use="required">
44 <xs:simpleType>
45 <xs:restriction base="xs:string">
46 <xs:enumeration value="none"/>
47 <xs:enumeration value="some"/>
48 <xs:enumeration value="indent"/>
49 </xs:restriction>
50 </xs:simpleType>
51 </xs:attribute>
52 </xs:complexType>
53 </xs:element>
54
55 </xs:all>
56 </xs:complexType>
57 </xs:element>
58</xs:schema>
59
60<!-- vim:set et sw=2 ts=2: -->
610
=== added directory 'modules/json'
=== added file 'modules/json/CMakeLists.txt'
--- modules/json/CMakeLists.txt 1970-01-01 00:00:00 +0000
+++ modules/json/CMakeLists.txt 2013-07-11 06:16:30 +0000
@@ -0,0 +1,16 @@
1# Copyright 2013 The FLWOR Foundation.
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15DECLARE_ZORBA_MODULE(FILE json-xml.xq VERSION 1.0
16 URI "http://zorba.io/modules/json-xml")
017
=== renamed file 'modules/com/zorba-xquery/www/modules/converters/json.xq' => 'modules/json/json-xml.xq'
--- modules/com/zorba-xquery/www/modules/converters/json.xq 2013-06-25 03:55:20 +0000
+++ modules/json/json-xml.xq 2013-07-11 06:16:30 +0000
@@ -18,7 +18,7 @@
1818
19 (:~19 (:~
20 : Using this module, you can parse JSON data into XML, manipulate it like any20 : Using this module, you can parse JSON data into XML, manipulate it like any
21 : other XML data using XQuery, and serialize the result back as JSON.21 : other XML data using XQuery, and serialize the result back as JSON.<p/>
22 :22 :
23 : There are many ways to represent JSON data in XML, some loss-less ("round23 : There are many ways to represent JSON data in XML, some loss-less ("round
24 : tripable") and some lossy ("one way"). Loss-less representations preserve24 : tripable") and some lossy ("one way"). Loss-less representations preserve
@@ -93,34 +93,25 @@
93 : @author Paul J. Lucas93 : @author Paul J. Lucas
94 : @project Zorba/Data Converters/JSON94 : @project Zorba/Data Converters/JSON
95 :)95 :)
96module namespace json = "http://www.zorba-xquery.com/modules/converters/json";96module namespace jx = "http://zorba.io/modules/json-xml";
97
98import module namespace schema = "http://www.zorba-xquery.com/modules/schema";
99
100import schema namespace json-options =
101 "http://www.zorba-xquery.com/modules/converters/json-options";
10297
103declare namespace an = "http://www.zorba-xquery.com/annotations";98declare namespace an = "http://www.zorba-xquery.com/annotations";
104declare namespace err = "http://www.w3.org/2005/xqt-errors";99declare namespace err = "http://www.w3.org/2005/xqt-errors";
105declare namespace zerr = "http://zorba.io/modules/zorba-errors";100declare namespace zerr = "http://zorba.io/modules/zorba-errors";
106101
107declare namespace ver = "http://www.zorba-xquery.com/options/versioning";102declare namespace ver = "http://www.zorba-xquery.com/options/versioning";
108declare option ver:module-version "2.0";103declare option ver:module-version "1.0";
109104
110(:~105(:~
111 : Parses JSON data from a string and returns an XDM instance using one of the106 : Parses JSON data from a string and returns an XDM instance using one of the
112 : representations described above.107 : representations described above.<p/>
113 :108 :
114 : @param $json The JSON data to parse.109 : @param $json The JSON data to parse.
115 : @param $options The parsing options, for example:110 : @param $options The parsing options, for example:
116 : <pre>111 : <pre>
117 : &lt;options xmlns="http://www.zorba-xquery.com/modules/converters/json-options"&gt;112 : { "json-format" : "JsonML-array" }
118 : &lt;json-format value="JsonML-array"/&gt;
119 : &lt;/options&gt;
120 : </pre>113 : </pre>
121 : @return said XDM instance.114 : @return said XDM instance.
122 : @error err:XQDY0027 if $options can not be validated against the
123 : json-options schema.
124 : @error zerr:ZJPE0001 if $json contains an illegal JSON character.115 : @error zerr:ZJPE0001 if $json contains an illegal JSON character.
125 : @error zerr:ZJPE0002 if $json contains an illegal Unicode code-point.116 : @error zerr:ZJPE0002 if $json contains an illegal Unicode code-point.
126 : @error zerr:ZJPE0003 if $json contains an illegal JSON character escape.117 : @error zerr:ZJPE0003 if $json contains an illegal JSON character escape.
@@ -131,21 +122,17 @@
131 : @error zerr:ZJPE0008 if $json contains an illegal QName.122 : @error zerr:ZJPE0008 if $json contains an illegal QName.
132 : @example test/rbkt/Queries/zorba/json/json-jsonml_array-parse-01.xq123 : @example test/rbkt/Queries/zorba/json/json-jsonml_array-parse-01.xq
133 :)124 :)
134declare function json:parse(125declare function jx:json-to-xml(
135 $json as xs:string?,126 $json as xs:string?,
136 $options as element(json-options:options)127 $options as object()
137) as element(*,xs:untyped)*128) as element(*,xs:untyped)*
138{129{
139 let $validated-options := if ( schema:is-validated( $options ) ) then130 jx:json-to-xml-internal( $json, $options )
140 $options
141 else
142 validate { $options }
143 return json:parse-internal( $json, $validated-options )
144};131};
145132
146(:~133(:~
147 : Parses JSON data from a string and returns an XDM instance using the Snelson134 : Parses JSON data from a string and returns an XDM instance using the Snelson
148 : representation described above.135 : representation described above.<p/>
149 :136 :
150 : @param $json The JSON data to parse.137 : @param $json The JSON data to parse.
151 : @return said XDM instance.138 : @return said XDM instance.
@@ -159,36 +146,25 @@
159 : @error zerr:ZJPE0008 if $json contains an illegal QName.146 : @error zerr:ZJPE0008 if $json contains an illegal QName.
160 : @example test/rbkt/Queries/zorba/json/json-snelson-parse-array-01.xq147 : @example test/rbkt/Queries/zorba/json/json-snelson-parse-array-01.xq
161 :)148 :)
162declare function json:parse(149declare function jx:json-to-xml(
163 $json as xs:string?150 $json as xs:string?
164) as element(*,xs:untyped)*151) as element(*,xs:untyped)*
165{152{
166 json:parse-internal(153 jx:json-to-xml-internal(
167 $json,154 $json, { "json-format" : "Snelson" }
168 validate {
169 <options
170 xmlns="http://www.zorba-xquery.com/modules/converters/json-options">
171 <json-format value="Snelson"/>
172 </options>
173 }
174 )155 )
175};156};
176157
177(:~158(:~
178 : Serializes an XDM into JSON using one of the representations described159 : Serializes an XDM into JSON using one of the representations described
179 : above.160 : above.<p/>
180 :161 :
181 : @param $xml The XDM to serialize.162 : @param $xml The XDM to serialize.
182 : @param $options The serializing options, for example:163 : @param $options The serializing options, for example:
183 : <pre>164 : <pre>
184 : &lt;options xmlns="http://www.zorba-xquery.com/modules/converters/json-options"&gt;165 : { "json-format" : "JsonML-array", "whitespace" : "indent" }
185 : &lt;json-format value="JsonML-array"/&gt;
186 : &lt;whitespace value="indent"/&gt;
187 : &lt;/options&gt;
188 : </pre>166 : </pre>
189 : @return a JSON string.167 : @return a JSON string.
190 : @error err:XQDY0027 if $options can not be validated against the
191 : json-options schema.
192 : @error zerr:ZJSE0001 if $xml is not a document or element node.168 : @error zerr:ZJSE0001 if $xml is not a document or element node.
193 : @error zerr:ZJSE0002 if $xml contains an element that is missing a required169 : @error zerr:ZJSE0002 if $xml contains an element that is missing a required
194 : attribute.170 : attribute.
@@ -201,21 +177,17 @@
201 : @error zerr:ZJSE0008 if $xml contains an illegal value for a JSON type.177 : @error zerr:ZJSE0008 if $xml contains an illegal value for a JSON type.
202 : @example test/rbkt/Queries/zorba/json/json-jsonml_array-serialize-01.xq178 : @example test/rbkt/Queries/zorba/json/json-jsonml_array-serialize-01.xq
203 :)179 :)
204declare function json:serialize(180declare function jx:xml-to-json(
205 $xml as item()*,181 $xml as item()*,
206 $options as element(json-options:options)182 $options as object()
207) as xs:string183) as xs:string
208{184{
209 let $validated-options := if ( schema:is-validated( $options ) ) then185 jx:xml-to-json-internal( $xml, $options )
210 $options
211 else
212 validate { $options }
213 return json:serialize-internal( $xml, $validated-options )
214};186};
215187
216(:~188(:~
217 : Serializes an XDM into JSON using one of the representations described189 : Serializes an XDM into JSON using one of the representations described
218 : above.190 : above.<p/>
219 :191 :
220 : @param $xml The XDM to serialize.192 : @param $xml The XDM to serialize.
221 : @return a JSON string.193 : @return a JSON string.
@@ -231,28 +203,21 @@
231 : @error zerr:ZJSE0008 if $xml contains an illegal value for a JSON type.203 : @error zerr:ZJSE0008 if $xml contains an illegal value for a JSON type.
232 : @example test/rbkt/Queries/zorba/json/json-snelson-serialize-array-01.xq204 : @example test/rbkt/Queries/zorba/json/json-snelson-serialize-array-01.xq
233 :)205 :)
234declare function json:serialize(206declare function jx:xml-to-json(
235 $xml as item()*207 $xml as item()*
236) as xs:string208) as xs:string
237{209{
238 json:serialize-internal($xml,210 jx:xml-to-json-internal($xml, { "json-format" : "Snelson" })
239 validate {
240 <options
241 xmlns="http://www.zorba-xquery.com/modules/converters/json-options">
242 <json-format value="Snelson"/>
243 </options>
244 }
245 )
246};211};
247212
248(:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::)213(:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::)
249214
250declare %private function json:parse-internal(215declare %private function jx:json-to-xml-internal(
251 $json as xs:string?,216 $json as xs:string?,
252 $options as item()?217 $options as item()?
253) as element()* external;218) as element()* external;
254219
255declare %an:streamable %private function json:serialize-internal(220declare %an:streamable %private function jx:xml-to-json-internal(
256 $xml as item()*,221 $xml as item()*,
257 $options as item()?222 $options as item()?
258) as xs:string external;223) as xs:string external;
259224
=== modified file 'src/context/static_context.cpp'
--- src/context/static_context.cpp 2013-07-04 22:17:19 +0000
+++ src/context/static_context.cpp 2013-07-11 06:16:30 +0000
@@ -355,7 +355,7 @@
355355
356const char*356const char*
357static_context::ZORBA_JSON_FN_NS =357static_context::ZORBA_JSON_FN_NS =
358"http://www.zorba-xquery.com/modules/converters/json";358"http://zorba.io/modules/json-xml";
359359
360const char*360const char*
361static_context::ZORBA_NODEREF_FN_NS =361static_context::ZORBA_NODEREF_FN_NS =
362362
=== modified file 'src/functions/pregenerated/func_json.cpp'
--- src/functions/pregenerated/func_json.cpp 2013-03-05 23:11:50 +0000
+++ src/functions/pregenerated/func_json.cpp 2013-07-11 06:16:30 +0000
@@ -31,24 +31,24 @@
3131
3232
3333
34PlanIter_t fn_zorba_json_parse_internal::codegen(34PlanIter_t fn_zorba_json_json_to_xml_internal::codegen(
35 CompilerCB*,35 CompilerCB*,
36 static_context* sctx,36 static_context* sctx,
37 const QueryLoc& loc,37 const QueryLoc& loc,
38 std::vector<PlanIter_t>& argv,38 std::vector<PlanIter_t>& argv,
39 expr& ann) const39 expr& ann) const
40{40{
41 return new JSONParseInternal(sctx, loc, argv);41 return new JSONtoXMLInternal(sctx, loc, argv);
42}42}
4343
44PlanIter_t fn_zorba_json_serialize_internal::codegen(44PlanIter_t fn_zorba_json_xml_to_json_internal::codegen(
45 CompilerCB*,45 CompilerCB*,
46 static_context* sctx,46 static_context* sctx,
47 const QueryLoc& loc,47 const QueryLoc& loc,
48 std::vector<PlanIter_t>& argv,48 std::vector<PlanIter_t>& argv,
49 expr& ann) const49 expr& ann) const
50{50{
51 return new JSONSerializeInternal(sctx, loc, argv);51 return new XMLtoJSONInternal(sctx, loc, argv);
52}52}
5353
54void populate_context_json(static_context* sctx)54void populate_context_json(static_context* sctx)
@@ -56,12 +56,12 @@
5656
5757
58 {58 {
59 DECL_WITH_KIND(sctx, fn_zorba_json_parse_internal,59 DECL_WITH_KIND(sctx, fn_zorba_json_json_to_xml_internal,
60 (createQName("http://www.zorba-xquery.com/modules/converters/json","","parse-internal"), 60 (createQName("http://zorba.io/modules/json-xml","","json-to-xml-internal"),
61 GENV_TYPESYSTEM.STRING_TYPE_ONE, 61 GENV_TYPESYSTEM.STRING_TYPE_ONE,
62 GENV_TYPESYSTEM.ITEM_TYPE_QUESTION, 62 GENV_TYPESYSTEM.ITEM_TYPE_QUESTION,
63 GENV_TYPESYSTEM.ELEMENT_TYPE_STAR),63 GENV_TYPESYSTEM.ELEMENT_TYPE_STAR),
64 FunctionConsts::FN_ZORBA_JSON_PARSE_INTERNAL_2);64 FunctionConsts::FN_ZORBA_JSON_JSON_TO_XML_INTERNAL_2);
6565
66 }66 }
6767
@@ -69,12 +69,12 @@
6969
7070
71 {71 {
72 DECL_WITH_KIND(sctx, fn_zorba_json_serialize_internal,72 DECL_WITH_KIND(sctx, fn_zorba_json_xml_to_json_internal,
73 (createQName("http://www.zorba-xquery.com/modules/converters/json","","serialize-internal"), 73 (createQName("http://zorba.io/modules/json-xml","","xml-to-json-internal"),
74 GENV_TYPESYSTEM.ITEM_TYPE_STAR, 74 GENV_TYPESYSTEM.ITEM_TYPE_STAR,
75 GENV_TYPESYSTEM.ITEM_TYPE_QUESTION, 75 GENV_TYPESYSTEM.ITEM_TYPE_QUESTION,
76 GENV_TYPESYSTEM.STRING_TYPE_ONE),76 GENV_TYPESYSTEM.STRING_TYPE_ONE),
77 FunctionConsts::FN_ZORBA_JSON_SERIALIZE_INTERNAL_2);77 FunctionConsts::FN_ZORBA_JSON_XML_TO_JSON_INTERNAL_2);
7878
79 }79 }
8080
8181
=== modified file 'src/functions/pregenerated/func_json.h'
--- src/functions/pregenerated/func_json.h 2013-03-05 23:11:50 +0000
+++ src/functions/pregenerated/func_json.h 2013-07-11 06:16:30 +0000
@@ -38,11 +38,11 @@
3838
3939
4040
41//fn-zorba-json:parse-internal41//fn-zorba-json:json-to-xml-internal
42class fn_zorba_json_parse_internal : public function42class fn_zorba_json_json_to_xml_internal : public function
43{43{
44public:44public:
45 fn_zorba_json_parse_internal(const signature& sig, FunctionConsts::FunctionKind kind)45 fn_zorba_json_json_to_xml_internal(const signature& sig, FunctionConsts::FunctionKind kind)
46 : 46 :
47 function(sig, kind)47 function(sig, kind)
48 {48 {
@@ -53,11 +53,11 @@
53};53};
5454
5555
56//fn-zorba-json:serialize-internal56//fn-zorba-json:xml-to-json-internal
57class fn_zorba_json_serialize_internal : public function57class fn_zorba_json_xml_to_json_internal : public function
58{58{
59public:59public:
60 fn_zorba_json_serialize_internal(const signature& sig, FunctionConsts::FunctionKind kind)60 fn_zorba_json_xml_to_json_internal(const signature& sig, FunctionConsts::FunctionKind kind)
61 : 61 :
62 function(sig, kind)62 function(sig, kind)
63 {63 {
6464
=== modified file 'src/functions/pregenerated/function_enum.h'
--- src/functions/pregenerated/function_enum.h 2013-06-26 00:10:23 +0000
+++ src/functions/pregenerated/function_enum.h 2013-07-11 06:16:30 +0000
@@ -250,8 +250,8 @@
250 FN_ZORBA_INTROSPECT_SCTX_OPTION_1,250 FN_ZORBA_INTROSPECT_SCTX_OPTION_1,
251 FN_ZORBA_INTROSPECT_SCTX_FUNCTION_ANNOTATIONS_2,251 FN_ZORBA_INTROSPECT_SCTX_FUNCTION_ANNOTATIONS_2,
252 FN_ZORBA_ITEM_SIZE_1,252 FN_ZORBA_ITEM_SIZE_1,
253 FN_ZORBA_JSON_PARSE_INTERNAL_2,253 FN_ZORBA_JSON_JSON_TO_XML_INTERNAL_2,
254 FN_ZORBA_JSON_SERIALIZE_INTERNAL_2,254 FN_ZORBA_JSON_XML_TO_JSON_INTERNAL_2,
255 FN_JSONIQ_DECODE_FROM_ROUNDTRIP_1,255 FN_JSONIQ_DECODE_FROM_ROUNDTRIP_1,
256 FN_JSONIQ_DECODE_FROM_ROUNDTRIP_2,256 FN_JSONIQ_DECODE_FROM_ROUNDTRIP_2,
257 FN_JSONIQ_ENCODE_FOR_ROUNDTRIP_1,257 FN_JSONIQ_ENCODE_FOR_ROUNDTRIP_1,
258258
=== modified file 'src/runtime/json/json_impl.cpp'
--- src/runtime/json/json_impl.cpp 2013-06-01 00:30:39 +0000
+++ src/runtime/json/json_impl.cpp 2013-07-11 06:16:30 +0000
@@ -39,27 +39,22 @@
3939
40typedef map<zstring,zstring> options_type;40typedef map<zstring,zstring> options_type;
4141
42static void get_options( store::Item_t const &options_element,42static void get_options( store::Item_t const &options_object,
43 options_type *options ) {43 options_type *options ) {
44 ZORBA_ASSERT( options_element->getNodeKind() ==44 ZORBA_ASSERT( options_object->getKind() == store::Item::OBJECT );
45 store::StoreConsts::elementNode );45 store::Iterator_t i = options_object->getObjectKeys();
46 store::Iterator_t i = options_element->getChildren();
47 i->open();46 i->open();
48 store::Item_t option_item;47 store::Item_t option_key;
49 while ( i->next( option_item ) ) {48 while ( i->next( option_key ) ) {
50 if ( option_item->getNodeKind() == store::StoreConsts::elementNode ) {49 zstring const name( option_key->getStringValue() );
51 zstring const name( option_item->getNodeName()->getStringValue() );50 (*options)[ name ] = options_object->getObjectValue(option_key)->getStringValue();
52 zstring value;
53 get_attribute_value( option_item, "value", &value );
54 (*options)[ name ] = value;
55 }
56 }51 }
57 i->close();52 i->close();
58}53}
5954
60///////////////////////////////////////////////////////////////////////////////55///////////////////////////////////////////////////////////////////////////////
6156
62bool JSONParseInternal::nextImpl( store::Item_t& result,57bool JSONtoXMLInternal::nextImpl( store::Item_t& result,
63 PlanState &planState ) const {58 PlanState &planState ) const {
64 store::Item_t cur_item;59 store::Item_t cur_item;
65 options_type options;60 options_type options;
@@ -190,7 +185,7 @@
190185
191///////////////////////////////////////////////////////////////////////////////186///////////////////////////////////////////////////////////////////////////////
192187
193bool JSONSerializeInternal::nextImpl( store::Item_t& result,188bool XMLtoJSONInternal::nextImpl( store::Item_t& result,
194 PlanState &planState ) const {189 PlanState &planState ) const {
195 store::Item_t cur_item;190 store::Item_t cur_item;
196 options_type options;191 options_type options;
197192
=== modified file 'src/runtime/json/pregenerated/json.cpp'
--- src/runtime/json/pregenerated/json.cpp 2013-03-05 23:11:50 +0000
+++ src/runtime/json/pregenerated/json.cpp 2013-07-11 06:16:30 +0000
@@ -32,60 +32,60 @@
3232
33namespace zorba {33namespace zorba {
3434
35// <JSONParseInternal>35// <JSONtoXMLInternal>
36SERIALIZABLE_CLASS_VERSIONS(JSONParseInternal)36SERIALIZABLE_CLASS_VERSIONS(JSONtoXMLInternal)
3737
38void JSONParseInternal::serialize(::zorba::serialization::Archiver& ar)38void JSONtoXMLInternal::serialize(::zorba::serialization::Archiver& ar)
39{39{
40 serialize_baseclass(ar,40 serialize_baseclass(ar,
41 (NaryBaseIterator<JSONParseInternal, PlanIteratorState>*)this);41 (NaryBaseIterator<JSONtoXMLInternal, PlanIteratorState>*)this);
42}42}
4343
4444
45void JSONParseInternal::accept(PlanIterVisitor& v) const45void JSONtoXMLInternal::accept(PlanIterVisitor& v) const
46{46{
47 v.beginVisit(*this);47 v.beginVisit(*this);
4848
49 std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin();49 std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin();
50 std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end();50 std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end();
51 for ( ; lIter != lEnd; ++lIter ){51 for ( ; lIter != lEnd; ++lIter ){
52 (*lIter)->accept(v);52 (*lIter)->accept(v);
53 }53 }
5454
55 v.endVisit(*this);55 v.endVisit(*this);
56}56}
5757
58JSONParseInternal::~JSONParseInternal() {}58JSONtoXMLInternal::~JSONtoXMLInternal() {}
5959
60// </JSONParseInternal>60// </JSONtoXMLInternal>
6161
6262
63// <JSONSerializeInternal>63// <XMLtoJSONInternal>
64SERIALIZABLE_CLASS_VERSIONS(JSONSerializeInternal)64SERIALIZABLE_CLASS_VERSIONS(XMLtoJSONInternal)
6565
66void JSONSerializeInternal::serialize(::zorba::serialization::Archiver& ar)66void XMLtoJSONInternal::serialize(::zorba::serialization::Archiver& ar)
67{67{
68 serialize_baseclass(ar,68 serialize_baseclass(ar,
69 (NaryBaseIterator<JSONSerializeInternal, PlanIteratorState>*)this);69 (NaryBaseIterator<XMLtoJSONInternal, PlanIteratorState>*)this);
70}70}
7171
7272
73void JSONSerializeInternal::accept(PlanIterVisitor& v) const73void XMLtoJSONInternal::accept(PlanIterVisitor& v) const
74{74{
75 v.beginVisit(*this);75 v.beginVisit(*this);
7676
77 std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin();77 std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin();
78 std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end();78 std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end();
79 for ( ; lIter != lEnd; ++lIter ){79 for ( ; lIter != lEnd; ++lIter ){
80 (*lIter)->accept(v);80 (*lIter)->accept(v);
81 }81 }
8282
83 v.endVisit(*this);83 v.endVisit(*this);
84}84}
8585
86JSONSerializeInternal::~JSONSerializeInternal() {}86XMLtoJSONInternal::~XMLtoJSONInternal() {}
8787
88// </JSONSerializeInternal>88// </XMLtoJSONInternal>
8989
9090
9191
9292
=== modified file 'src/runtime/json/pregenerated/json.h'
--- src/runtime/json/pregenerated/json.h 2013-03-05 23:11:50 +0000
+++ src/runtime/json/pregenerated/json.h 2013-07-11 06:16:30 +0000
@@ -39,25 +39,25 @@
39 * 39 *
40 * Author: Zorba Team40 * Author: Zorba Team
41 */41 */
42class JSONParseInternal : public NaryBaseIterator<JSONParseInternal, PlanIteratorState>42class JSONtoXMLInternal : public NaryBaseIterator<JSONtoXMLInternal, PlanIteratorState>
43{ 43{
44public:44public:
45 SERIALIZABLE_CLASS(JSONParseInternal);45 SERIALIZABLE_CLASS(JSONtoXMLInternal);
4646
47 SERIALIZABLE_CLASS_CONSTRUCTOR2T(JSONParseInternal,47 SERIALIZABLE_CLASS_CONSTRUCTOR2T(JSONtoXMLInternal,
48 NaryBaseIterator<JSONParseInternal, PlanIteratorState>);48 NaryBaseIterator<JSONtoXMLInternal, PlanIteratorState>);
4949
50 void serialize( ::zorba::serialization::Archiver& ar);50 void serialize( ::zorba::serialization::Archiver& ar);
5151
52 JSONParseInternal(52 JSONtoXMLInternal(
53 static_context* sctx,53 static_context* sctx,
54 const QueryLoc& loc,54 const QueryLoc& loc,
55 std::vector<PlanIter_t>& children)55 std::vector<PlanIter_t>& children)
56 : 56 :
57 NaryBaseIterator<JSONParseInternal, PlanIteratorState>(sctx, loc, children)57 NaryBaseIterator<JSONtoXMLInternal, PlanIteratorState>(sctx, loc, children)
58 {}58 {}
5959
60 virtual ~JSONParseInternal();60 virtual ~JSONtoXMLInternal();
6161
62 void accept(PlanIterVisitor& v) const;62 void accept(PlanIterVisitor& v) const;
6363
@@ -71,25 +71,25 @@
71 * 71 *
72 * Author: Zorba Team72 * Author: Zorba Team
73 */73 */
74class JSONSerializeInternal : public NaryBaseIterator<JSONSerializeInternal, PlanIteratorState>74class XMLtoJSONInternal : public NaryBaseIterator<XMLtoJSONInternal, PlanIteratorState>
75{ 75{
76public:76public:
77 SERIALIZABLE_CLASS(JSONSerializeInternal);77 SERIALIZABLE_CLASS(XMLtoJSONInternal);
7878
79 SERIALIZABLE_CLASS_CONSTRUCTOR2T(JSONSerializeInternal,79 SERIALIZABLE_CLASS_CONSTRUCTOR2T(XMLtoJSONInternal,
80 NaryBaseIterator<JSONSerializeInternal, PlanIteratorState>);80 NaryBaseIterator<XMLtoJSONInternal, PlanIteratorState>);
8181
82 void serialize( ::zorba::serialization::Archiver& ar);82 void serialize( ::zorba::serialization::Archiver& ar);
8383
84 JSONSerializeInternal(84 XMLtoJSONInternal(
85 static_context* sctx,85 static_context* sctx,
86 const QueryLoc& loc,86 const QueryLoc& loc,
87 std::vector<PlanIter_t>& children)87 std::vector<PlanIter_t>& children)
88 : 88 :
89 NaryBaseIterator<JSONSerializeInternal, PlanIteratorState>(sctx, loc, children)89 NaryBaseIterator<XMLtoJSONInternal, PlanIteratorState>(sctx, loc, children)
90 {}90 {}
9191
92 virtual ~JSONSerializeInternal();92 virtual ~XMLtoJSONInternal();
9393
94 void accept(PlanIterVisitor& v) const;94 void accept(PlanIterVisitor& v) const;
9595
9696
=== modified file 'src/runtime/pregenerated/iterator_enum.h'
--- src/runtime/pregenerated/iterator_enum.h 2013-06-08 05:33:57 +0000
+++ src/runtime/pregenerated/iterator_enum.h 2013-07-11 06:16:30 +0000
@@ -162,8 +162,8 @@
162 TYPE_OptionIterator,162 TYPE_OptionIterator,
163 TYPE_FunctionAnnotationsIterator,163 TYPE_FunctionAnnotationsIterator,
164 TYPE_MemSizeIterator,164 TYPE_MemSizeIterator,
165 TYPE_JSONParseInternal,165 TYPE_JSONtoXMLInternal,
166 TYPE_JSONSerializeInternal,166 TYPE_XMLtoJSONInternal,
167 TYPE_JSONDecodeFromRoundtripIterator,167 TYPE_JSONDecodeFromRoundtripIterator,
168 TYPE_JSONEncodeForRoundtripIterator,168 TYPE_JSONEncodeForRoundtripIterator,
169 TYPE_JSONParseIterator,169 TYPE_JSONParseIterator,
170170
=== modified file 'src/runtime/spec/json/json.xml'
--- src/runtime/spec/json/json.xml 2011-12-16 19:36:24 +0000
+++ src/runtime/spec/json/json.xml 2013-07-11 06:16:30 +0000
@@ -13,14 +13,14 @@
13/*******************************************************************************13/*******************************************************************************
14*******************************************************************************/14*******************************************************************************/
15-->15-->
16<zorba:iterator name="JSONParseInternal" arity="nary">16<zorba:iterator name="JSONtoXMLInternal" arity="nary">
1717
18 <zorba:description author="Zorba Team">18 <zorba:description author="Zorba Team">
19 function for parsing strings into json-xdm19 function for parsing strings into json-xdm
20 </zorba:description>20 </zorba:description>
2121
22 <zorba:function isDeterministic="true">22 <zorba:function isDeterministic="true">
23 <zorba:signature localname="parse-internal" prefix="fn-zorba-json">23 <zorba:signature localname="json-to-xml-internal" prefix="fn-zorba-json">
24 <zorba:param>xs:string</zorba:param>24 <zorba:param>xs:string</zorba:param>
25 <zorba:param>item()?</zorba:param>25 <zorba:param>item()?</zorba:param>
26 <zorba:output>element()*</zorba:output>26 <zorba:output>element()*</zorba:output>
@@ -33,14 +33,14 @@
33/*******************************************************************************33/*******************************************************************************
34*******************************************************************************/34*******************************************************************************/
35-->35-->
36<zorba:iterator name="JSONSerializeInternal" arity="nary">36<zorba:iterator name="XMLtoJSONInternal" arity="nary">
3737
38 <zorba:description author="Zorba Team">38 <zorba:description author="Zorba Team">
39 Function to serialize json/jsonml xdm to string39 Function to serialize json/jsonml xdm to string
40 </zorba:description>40 </zorba:description>
4141
42 <zorba:function isDeterministic="true">42 <zorba:function isDeterministic="true">
43 <zorba:signature localname="serialize-internal" prefix="fn-zorba-json">43 <zorba:signature localname="xml-to-json-internal" prefix="fn-zorba-json">
44 <zorba:param>item()*</zorba:param>44 <zorba:param>item()*</zorba:param>
45 <zorba:param>item()?</zorba:param>45 <zorba:param>item()?</zorba:param>
46 <zorba:output>xs:string</zorba:output>46 <zorba:output>xs:string</zorba:output>
4747
=== modified file 'src/runtime/spec/mappings.xml'
--- src/runtime/spec/mappings.xml 2013-07-04 22:17:19 +0000
+++ src/runtime/spec/mappings.xml 2013-07-11 06:16:30 +0000
@@ -118,7 +118,7 @@
118 define="ZORBA_URI_FN_NS" 118 define="ZORBA_URI_FN_NS"
119 prefix="fn-zorba-uri"/>119 prefix="fn-zorba-uri"/>
120120
121 <zorba:namespace uri="http://www.zorba-xquery.com/modules/converters/json"121 <zorba:namespace uri="http://zorba.io/modules/json-xml"
122 define="ZORBA_JSON_FN_NS" 122 define="ZORBA_JSON_FN_NS"
123 prefix="fn-zorba-json"/>123 prefix="fn-zorba-json"/>
124124
125125
=== modified file 'src/runtime/visitors/pregenerated/planiter_visitor.h'
--- src/runtime/visitors/pregenerated/planiter_visitor.h 2013-06-08 05:33:57 +0000
+++ src/runtime/visitors/pregenerated/planiter_visitor.h 2013-07-11 06:16:30 +0000
@@ -330,9 +330,9 @@
330330
331 class MemSizeIterator;331 class MemSizeIterator;
332332
333 class JSONParseInternal;333 class JSONtoXMLInternal;
334334
335 class JSONSerializeInternal;335 class XMLtoJSONInternal;
336336
337 class JSONDecodeFromRoundtripIterator;337 class JSONDecodeFromRoundtripIterator;
338338
@@ -1207,11 +1207,11 @@
1207 virtual void beginVisit ( const MemSizeIterator& ) = 0;1207 virtual void beginVisit ( const MemSizeIterator& ) = 0;
1208 virtual void endVisit ( const MemSizeIterator& ) = 0;1208 virtual void endVisit ( const MemSizeIterator& ) = 0;
12091209
1210 virtual void beginVisit ( const JSONParseInternal& ) = 0;1210 virtual void beginVisit ( const JSONtoXMLInternal& ) = 0;
1211 virtual void endVisit ( const JSONParseInternal& ) = 0;1211 virtual void endVisit ( const JSONtoXMLInternal& ) = 0;
12121212
1213 virtual void beginVisit ( const JSONSerializeInternal& ) = 0;1213 virtual void beginVisit ( const XMLtoJSONInternal& ) = 0;
1214 virtual void endVisit ( const JSONSerializeInternal& ) = 0;1214 virtual void endVisit ( const XMLtoJSONInternal& ) = 0;
12151215
1216 virtual void beginVisit ( const JSONDecodeFromRoundtripIterator& ) = 0;1216 virtual void beginVisit ( const JSONDecodeFromRoundtripIterator& ) = 0;
1217 virtual void endVisit ( const JSONDecodeFromRoundtripIterator& ) = 0;1217 virtual void endVisit ( const JSONDecodeFromRoundtripIterator& ) = 0;
12181218
=== modified file 'src/runtime/visitors/pregenerated/printer_visitor.cpp'
--- src/runtime/visitors/pregenerated/printer_visitor.cpp 2013-06-08 05:33:57 +0000
+++ src/runtime/visitors/pregenerated/printer_visitor.cpp 2013-07-11 06:16:30 +0000
@@ -1985,32 +1985,32 @@
1985// </MemSizeIterator>1985// </MemSizeIterator>
19861986
19871987
1988// <JSONParseInternal>1988// <JSONtoXMLInternal>
1989void PrinterVisitor::beginVisit ( const JSONParseInternal& a) {1989void PrinterVisitor::beginVisit ( const JSONtoXMLInternal& a) {
1990 thePrinter.startBeginVisit("JSONParseInternal", ++theId);1990 thePrinter.startBeginVisit("JSONtoXMLInternal", ++theId);
1991 printCommons( &a, theId );1991 printCommons( &a, theId );
1992 thePrinter.endBeginVisit( theId );1992 thePrinter.endBeginVisit( theId );
1993}1993}
19941994
1995void PrinterVisitor::endVisit ( const JSONParseInternal& ) {1995void PrinterVisitor::endVisit ( const JSONtoXMLInternal& ) {
1996 thePrinter.startEndVisit();1996 thePrinter.startEndVisit();
1997 thePrinter.endEndVisit();1997 thePrinter.endEndVisit();
1998}1998}
1999// </JSONParseInternal>1999// </JSONtoXMLInternal>
20002000
20012001
2002// <JSONSerializeInternal>2002// <XMLtoJSONInternal>
2003void PrinterVisitor::beginVisit ( const JSONSerializeInternal& a) {2003void PrinterVisitor::beginVisit ( const XMLtoJSONInternal& a) {
2004 thePrinter.startBeginVisit("JSONSerializeInternal", ++theId);2004 thePrinter.startBeginVisit("XMLtoJSONInternal", ++theId);
2005 printCommons( &a, theId );2005 printCommons( &a, theId );
2006 thePrinter.endBeginVisit( theId );2006 thePrinter.endBeginVisit( theId );
2007}2007}
20082008
2009void PrinterVisitor::endVisit ( const JSONSerializeInternal& ) {2009void PrinterVisitor::endVisit ( const XMLtoJSONInternal& ) {
2010 thePrinter.startEndVisit();2010 thePrinter.startEndVisit();
2011 thePrinter.endEndVisit();2011 thePrinter.endEndVisit();
2012}2012}
2013// </JSONSerializeInternal>2013// </XMLtoJSONInternal>
20142014
20152015
2016// <JSONDecodeFromRoundtripIterator>2016// <JSONDecodeFromRoundtripIterator>
20172017
=== modified file 'src/runtime/visitors/pregenerated/printer_visitor.h'
--- src/runtime/visitors/pregenerated/printer_visitor.h 2013-06-08 05:33:57 +0000
+++ src/runtime/visitors/pregenerated/printer_visitor.h 2013-07-11 06:16:30 +0000
@@ -505,11 +505,11 @@
505 void beginVisit( const MemSizeIterator& );505 void beginVisit( const MemSizeIterator& );
506 void endVisit ( const MemSizeIterator& );506 void endVisit ( const MemSizeIterator& );
507507
508 void beginVisit( const JSONParseInternal& );508 void beginVisit( const JSONtoXMLInternal& );
509 void endVisit ( const JSONParseInternal& );509 void endVisit ( const JSONtoXMLInternal& );
510510
511 void beginVisit( const JSONSerializeInternal& );511 void beginVisit( const XMLtoJSONInternal& );
512 void endVisit ( const JSONSerializeInternal& );512 void endVisit ( const XMLtoJSONInternal& );
513513
514 void beginVisit( const JSONDecodeFromRoundtripIterator& );514 void beginVisit( const JSONDecodeFromRoundtripIterator& );
515 void endVisit ( const JSONDecodeFromRoundtripIterator& );515 void endVisit ( const JSONDecodeFromRoundtripIterator& );
516516
=== modified file 'test/rbkt/Queries/CMakeLists.txt'
--- test/rbkt/Queries/CMakeLists.txt 2013-06-18 11:51:57 +0000
+++ test/rbkt/Queries/CMakeLists.txt 2013-07-11 06:16:30 +0000
@@ -583,3 +583,4 @@
583EXPECTED_FAILURE(test/rbkt/zorba/jsoniq/comment_04.jq 1067028)583EXPECTED_FAILURE(test/rbkt/zorba/jsoniq/comment_04.jq 1067028)
584EXPECTED_FAILURE(test/rbkt/zorba/jsoniq/comment_05.jq 1067028)584EXPECTED_FAILURE(test/rbkt/zorba/jsoniq/comment_05.jq 1067028)
585585
586EXPECTED_FAILURE(test/rbkt/zorba/json/json-invalid-option-parameter 1200089)
586587
=== modified file 'test/rbkt/Queries/zorba/error/data-location-json-2.xq'
--- test/rbkt/Queries/zorba/error/data-location-json-2.xq 2013-06-25 03:55:20 +0000
+++ test/rbkt/Queries/zorba/error/data-location-json-2.xq 2013-07-11 06:16:30 +0000
@@ -1,12 +1,12 @@
1import module namespace file = "http://expath.org/ns/file";1import module namespace file = "http://expath.org/ns/file";
2import module namespace json = "http://www.zorba-xquery.com/modules/converters/json";2import module namespace jx = "http://zorba.io/modules/json-xml";
3declare namespace zerr = "http://zorba.io/modules/zorba-errors";3declare namespace zerr = "http://zorba.io/modules/zorba-errors";
44
5let $file := "$RBKT_SRC_DIR/Queries/zorba/error/data-location.json"5let $file := "$RBKT_SRC_DIR/Queries/zorba/error/data-location.json"
6let $json := file:read-text( $file )6let $json := file:read-text( $file )
7return7return
8 try {8 try {
9 json:parse( $json )9 jx:json-to-xml( $json )
10 }10 }
11 catch * {11 catch * {
12 file:base-name( $zerr:data-uri ),12 file:base-name( $zerr:data-uri ),
1313
=== modified file 'test/rbkt/Queries/zorba/json/json-invalid-option-parameter.xq'
--- test/rbkt/Queries/zorba/json/json-invalid-option-parameter.xq 2012-01-24 01:20:54 +0000
+++ test/rbkt/Queries/zorba/json/json-invalid-option-parameter.xq 2013-07-11 06:16:30 +0000
@@ -1,10 +1,6 @@
1(: try parsing a valid JSON string with invalid JSON option parameter :)1(: try parsing a valid JSON string with invalid JSON option parameter :)
22
3import module namespace json = "http://www.zorba-xquery.com/modules/converters/json";3import module namespace jx = "http://zorba.io/modules/json-xml";
44
5let $options :=5let $options := { "json-format" : "array" }
6 <options xmlns="http://www.zorba-xquery.com/modules/converters/json-options">6return jx:json-to-xml('{}',$options)
7 <json-format value="array"/>
8 </options>
9
10return json:parse('{}',$options)
117
=== modified file 'test/rbkt/Queries/zorba/json/json-jsonml_array-parse-01.xq'
--- test/rbkt/Queries/zorba/json/json-jsonml_array-parse-01.xq 2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/json/json-jsonml_array-parse-01.xq 2013-07-11 06:16:30 +0000
@@ -1,10 +1,7 @@
1import module namespace json = "http://www.zorba-xquery.com/modules/converters/json";1import module namespace jx = "http://zorba.io/modules/json-xml";
22
3let $json := '[ "li", "list item" ]'3let $json := '[ "li", "list item" ]'
4let $options :=4let $options := { "json-format" : "JsonML-array" }
5 <options xmlns="http://www.zorba-xquery.com/modules/converters/json-options">5return jx:json-to-xml( $json, $options )
6 <json-format value="JsonML-array"/>
7 </options>
8return json:parse( $json, $options )
96
10(: vim:set et sw=2 ts=2: :)7(: vim:set et sw=2 ts=2: :)
118
=== modified file 'test/rbkt/Queries/zorba/json/json-jsonml_array-parse-02.xq'
--- test/rbkt/Queries/zorba/json/json-jsonml_array-parse-02.xq 2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/json/json-jsonml_array-parse-02.xq 2013-07-11 06:16:30 +0000
@@ -1,4 +1,4 @@
1import module namespace json = "http://www.zorba-xquery.com/modules/converters/json";1import module namespace jx = "http://zorba.io/modules/json-xml";
22
3let $json := '3let $json := '
4 [ "ul",4 [ "ul",
@@ -6,10 +6,7 @@
6 [ "li", "list item 2" ]6 [ "li", "list item 2" ]
7 ]7 ]
8'8'
9let $options :=9let $options := { "json-format" : "JsonML-array" }
10 <options xmlns="http://www.zorba-xquery.com/modules/converters/json-options">10return jx:json-to-xml( $json, $options )
11 <json-format value="JsonML-array"/>
12 </options>
13return json:parse( $json, $options )
1411
15(: vim:set et sw=2 ts=2: :)12(: vim:set et sw=2 ts=2: :)
1613
=== modified file 'test/rbkt/Queries/zorba/json/json-jsonml_array-parse-03.xq'
--- test/rbkt/Queries/zorba/json/json-jsonml_array-parse-03.xq 2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/json/json-jsonml_array-parse-03.xq 2013-07-11 06:16:30 +0000
@@ -1,4 +1,4 @@
1import module namespace json = "http://www.zorba-xquery.com/modules/converters/json";1import module namespace jx = "http://zorba.io/modules/json-xml";
22
3let $json := '3let $json := '
4 [ "file",4 [ "file",
@@ -10,10 +10,7 @@
10 }10 }
11 ]11 ]
12'12'
13let $options :=13let $options := { "json-format" : "JsonML-array" }
14 <options xmlns="http://www.zorba-xquery.com/modules/converters/json-options">14return jx:json-to-xml( $json, $options )
15 <json-format value="JsonML-array"/>
16 </options>
17return json:parse( $json, $options )
1815
19(: vim:set et sw=2 ts=2: :)16(: vim:set et sw=2 ts=2: :)
2017
=== modified file 'test/rbkt/Queries/zorba/json/json-jsonml_array-parse-04.xq'
--- test/rbkt/Queries/zorba/json/json-jsonml_array-parse-04.xq 2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/json/json-jsonml_array-parse-04.xq 2013-07-11 06:16:30 +0000
@@ -1,4 +1,4 @@
1import module namespace json = "http://www.zorba-xquery.com/modules/converters/json";1import module namespace jx = "http://zorba.io/modules/json-xml";
22
3let $json := '3let $json := '
4 [ "ul",4 [ "ul",
@@ -21,10 +21,7 @@
21 " Item"21 " Item"
22 ]22 ]
23 ]'23 ]'
24let $options :=24let $options := { "json-format" : "JsonML-array" }
25 <options xmlns="http://www.zorba-xquery.com/modules/converters/json-options">25return jx:json-to-xml( $json, $options )
26 <json-format value="JsonML-array"/>
27 </options>
28return json:parse( $json, $options )
2926
30(: vim:se et sw=2 ts=2: :)27(: vim:se et sw=2 ts=2: :)
3128
=== modified file 'test/rbkt/Queries/zorba/json/json-jsonml_array-parse-05.xq'
--- test/rbkt/Queries/zorba/json/json-jsonml_array-parse-05.xq 2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/json/json-jsonml_array-parse-05.xq 2013-07-11 06:16:30 +0000
@@ -1,4 +1,4 @@
1import module namespace json = "http://www.zorba-xquery.com/modules/converters/json";1import module namespace jx = "http://zorba.io/modules/json-xml";
22
3let $json := '["table",3let $json := '["table",
4{4{
@@ -59,10 +59,7 @@
59]59]
60]60]
61]'61]'
62let $options :=62let $options := { "json-format" : "JsonML-array" }
63 <options xmlns="http://www.zorba-xquery.com/modules/converters/json-options">63return jx:json-to-xml( $json, $options )
64 <json-format value="JsonML-array"/>
65 </options>
66return json:parse( $json, $options )
6764
68(: vim:se et sw=2 ts=2: :)65(: vim:se et sw=2 ts=2: :)
6966
=== modified file 'test/rbkt/Queries/zorba/json/json-jsonml_array-parse-06.xq'
--- test/rbkt/Queries/zorba/json/json-jsonml_array-parse-06.xq 2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/json/json-jsonml_array-parse-06.xq 2013-07-11 06:16:30 +0000
@@ -1,11 +1,8 @@
1(: try parsing an empty value :)1(: try parsing an empty value :)
22
3import module namespace json = "http://www.zorba-xquery.com/modules/converters/json";3import module namespace jx = "http://zorba.io/modules/json-xml";
44
5let $options :=5let $options := { "json-format" : "JsonML-array" }
6 <options xmlns="http://www.zorba-xquery.com/modules/converters/json-options">6return jx:json-to-xml( <a/>, $options )
7 <json-format value="JsonML-array"/>
8 </options>
9return json:parse( <a/>, $options )
107
11(: vim:set et sw=2 ts=2: :)8(: vim:set et sw=2 ts=2: :)
129
=== modified file 'test/rbkt/Queries/zorba/json/json-jsonml_array-parse-07.xq'
--- test/rbkt/Queries/zorba/json/json-jsonml_array-parse-07.xq 2012-05-13 15:33:57 +0000
+++ test/rbkt/Queries/zorba/json/json-jsonml_array-parse-07.xq 2013-07-11 06:16:30 +0000
@@ -1,14 +1,11 @@
1import module namespace json =1import module namespace jx =
2 "http://www.zorba-xquery.com/modules/converters/json";2 "http://zorba.io/modules/json-xml";
33
4let $opt :=4let $options := { "json-format" : "JsonML-array" }
5 <options xmlns="http://www.zorba-xquery.com/modules/converters/json-options">
6 <json-format value="JsonML-array"/>
7 </options>
8let $json :=5let $json :=
9 '{6 '{
10 "args": [ "<div><span>foo:</span> parse</div>" ]7 "args": [ "<div><span>foo:</span> parse</div>" ]
11 }'8 }'
12return json:parse( $json, $opt )9return jx:json-to-xml( $json, $options )
1310
14(: vim:set et sw=2 ts=2: :)11(: vim:set et sw=2 ts=2: :)
1512
=== modified file 'test/rbkt/Queries/zorba/json/json-jsonml_array-parse-08.xq'
--- test/rbkt/Queries/zorba/json/json-jsonml_array-parse-08.xq 2013-04-02 02:48:56 +0000
+++ test/rbkt/Queries/zorba/json/json-jsonml_array-parse-08.xq 2013-07-11 06:16:30 +0000
@@ -1,11 +1,8 @@
1import module namespace json =1import module namespace jx =
2 "http://www.zorba-xquery.com/modules/converters/json";2 "http://zorba.io/modules/json-xml";
33
4let $opt :=4let $options := { "json-format" : "JsonML-array" }
5 <options xmlns="http://www.zorba-xquery.com/modules/converters/json-options">
6 <json-format value="JsonML-array"/>
7 </options>
8let $json := '[ { "x" : "x" } ]'5let $json := '[ { "x" : "x" } ]'
9return json:parse( $json, $opt )6return jx:json-to-xml( $json, $options )
107
11(: vim:set et sw=2 ts=2: :)8(: vim:set et sw=2 ts=2: :)
129
=== modified file 'test/rbkt/Queries/zorba/json/json-jsonml_array-parse-wikipedia.xq'
--- test/rbkt/Queries/zorba/json/json-jsonml_array-parse-wikipedia.xq 2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/json/json-jsonml_array-parse-wikipedia.xq 2013-07-11 06:16:30 +0000
@@ -1,4 +1,4 @@
1import module namespace json = "http://www.zorba-xquery.com/modules/converters/json";1import module namespace jx = "http://zorba.io/modules/json-xml";
22
3let $json := '3let $json := '
4 [ "person",4 [ "person",
@@ -15,10 +15,7 @@
15 ]15 ]
16 ]16 ]
17'17'
18let $options :=18let $options := { "json-format" : "JsonML-array" }
19 <options xmlns="http://www.zorba-xquery.com/modules/converters/json-options">19return jx:json-to-xml( $json, $options )
20 <json-format value="JsonML-array"/>
21 </options>
22return json:parse( $json, $options )
2320
24(: vim:set et sw=2 ts=2: :)21(: vim:set et sw=2 ts=2: :)
2522
=== modified file 'test/rbkt/Queries/zorba/json/json-jsonml_array-serialize-01.xq'
--- test/rbkt/Queries/zorba/json/json-jsonml_array-serialize-01.xq 2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/json/json-jsonml_array-serialize-01.xq 2013-07-11 06:16:30 +0000
@@ -1,11 +1,8 @@
1import module namespace json = "http://www.zorba-xquery.com/modules/converters/json";1import module namespace jx = "http://zorba.io/modules/json-xml";
22
3let $json :=3let $json :=
4 <li>list item</li>4 <li>list item</li>
5let $options :=5let $options := { "json-format" : "JsonML-array" }
6 <options xmlns="http://www.zorba-xquery.com/modules/converters/json-options">6return jx:xml-to-json( $json, $options )
7 <json-format value="JsonML-array"/>
8 </options>
9return json:serialize( $json, $options )
107
11(: vim:set et sw=2 ts=2: :)8(: vim:set et sw=2 ts=2: :)
129
=== modified file 'test/rbkt/Queries/zorba/json/json-jsonml_array-serialize-02.xq'
--- test/rbkt/Queries/zorba/json/json-jsonml_array-serialize-02.xq 2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/json/json-jsonml_array-serialize-02.xq 2013-07-11 06:16:30 +0000
@@ -1,14 +1,11 @@
1import module namespace json = "http://www.zorba-xquery.com/modules/converters/json";1import module namespace jx = "http://zorba.io/modules/json-xml";
22
3let $json :=3let $json :=
4 <ul>4 <ul>
5 <li>list item 1</li>5 <li>list item 1</li>
6 <li>list item 2</li>6 <li>list item 2</li>
7 </ul>7 </ul>
8let $options :=8let $options := { "json-format" : "JsonML-array" }
9 <options xmlns="http://www.zorba-xquery.com/modules/converters/json-options">9return jx:xml-to-json( $json, $options )
10 <json-format value="JsonML-array"/>
11 </options>
12return json:serialize( $json, $options )
1310
14(: vim:set et sw=2 ts=2: :)11(: vim:set et sw=2 ts=2: :)
1512
=== modified file 'test/rbkt/Queries/zorba/json/json-jsonml_array-serialize-03.xq'
--- test/rbkt/Queries/zorba/json/json-jsonml_array-serialize-03.xq 2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/json/json-jsonml_array-serialize-03.xq 2013-07-11 06:16:30 +0000
@@ -1,11 +1,8 @@
1import module namespace json = "http://www.zorba-xquery.com/modules/converters/json";1import module namespace jx = "http://zorba.io/modules/json-xml";
22
3let $json :=3let $json :=
4 <file dir="/tmp" name="foo" size="1234" modified="2006-12-31T23:59"/>4 <file dir="/tmp" name="foo" size="1234" modified="2006-12-31T23:59"/>
5let $options :=5let $options := { "json-format" : "JsonML-array" }
6 <options xmlns="http://www.zorba-xquery.com/modules/converters/json-options">6return jx:xml-to-json( $json, $options )
7 <json-format value="JsonML-array"/>
8 </options>
9return json:serialize( $json, $options )
107
11(: vim:set et sw=2 ts=2: :)8(: vim:set et sw=2 ts=2: :)
129
=== modified file 'test/rbkt/Queries/zorba/json/json-jsonml_array-serialize-indent-wikipedia.xq'
--- test/rbkt/Queries/zorba/json/json-jsonml_array-serialize-indent-wikipedia.xq 2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/json/json-jsonml_array-serialize-indent-wikipedia.xq 2013-07-11 06:16:30 +0000
@@ -1,4 +1,4 @@
1import module namespace json = "http://www.zorba-xquery.com/modules/converters/json";1import module namespace jx = "http://zorba.io/modules/json-xml";
22
3let $json :=3let $json :=
4 <person created="2006-11-11T19:23" modified="2006-12-31T23:59">4 <person created="2006-11-11T19:23" modified="2006-12-31T23:59">
@@ -11,11 +11,7 @@
11 <postalCode>98765-4321</postalCode>11 <postalCode>98765-4321</postalCode>
12 </address>12 </address>
13 </person>13 </person>
14let $options :=14let $options := { "json-format" : "JsonML-array", "whitespace" : "indent" }
15 <options xmlns="http://www.zorba-xquery.com/modules/converters/json-options">15return jx:xml-to-json( $json, $options )
16 <json-format value="JsonML-array"/>
17 <whitespace value="indent"/>
18 </options>
19return json:serialize( $json, $options )
2016
21(: vim:set et sw=2 ts=2: :)17(: vim:set et sw=2 ts=2: :)
2218
=== modified file 'test/rbkt/Queries/zorba/json/json-jsonml_array-serialize-none-wikipedia.xq'
--- test/rbkt/Queries/zorba/json/json-jsonml_array-serialize-none-wikipedia.xq 2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/json/json-jsonml_array-serialize-none-wikipedia.xq 2013-07-11 06:16:30 +0000
@@ -1,4 +1,4 @@
1import module namespace json = "http://www.zorba-xquery.com/modules/converters/json";1import module namespace jx = "http://zorba.io/modules/json-xml";
22
3let $json :=3let $json :=
4 <person created="2006-11-11T19:23" modified="2006-12-31T23:59">4 <person created="2006-11-11T19:23" modified="2006-12-31T23:59">
@@ -11,10 +11,7 @@
11 <postalCode>98765-4321</postalCode>11 <postalCode>98765-4321</postalCode>
12 </address>12 </address>
13 </person>13 </person>
14let $options :=14let $options := { "json-format" : "JsonML-array" }
15 <options xmlns="http://www.zorba-xquery.com/modules/converters/json-options">15return jx:xml-to-json( $json, $options )
16 <json-format value="JsonML-array"/>
17 </options>
18return json:serialize( $json, $options )
1916
20(: vim:set et sw=2 ts=2: :)17(: vim:set et sw=2 ts=2: :)
2118
=== modified file 'test/rbkt/Queries/zorba/json/json-jsonml_array-serialize-some-wikipedia.xq'
--- test/rbkt/Queries/zorba/json/json-jsonml_array-serialize-some-wikipedia.xq 2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/json/json-jsonml_array-serialize-some-wikipedia.xq 2013-07-11 06:16:30 +0000
@@ -1,4 +1,4 @@
1import module namespace json = "http://www.zorba-xquery.com/modules/converters/json";1import module namespace jx = "http://zorba.io/modules/json-xml";
22
3let $json :=3let $json :=
4 <person created="2006-11-11T19:23" modified="2006-12-31T23:59">4 <person created="2006-11-11T19:23" modified="2006-12-31T23:59">
@@ -11,11 +11,7 @@
11 <postalCode>98765-4321</postalCode>11 <postalCode>98765-4321</postalCode>
12 </address>12 </address>
13 </person>13 </person>
14let $options :=14let $options := { "json-format" : "JsonML-array", "whitespace" : "some" }
15 <options xmlns="http://www.zorba-xquery.com/modules/converters/json-options">15return jx:xml-to-json( $json, $options )
16 <json-format value="JsonML-array"/>
17 <whitespace value="some"/>
18 </options>
19return json:serialize( $json, $options )
2016
21(: vim:set et sw=2 ts=2: :)17(: vim:set et sw=2 ts=2: :)
2218
=== modified file 'test/rbkt/Queries/zorba/json/json-snelson-invalid-json.xq'
--- test/rbkt/Queries/zorba/json/json-snelson-invalid-json.xq 2012-01-23 23:22:52 +0000
+++ test/rbkt/Queries/zorba/json/json-snelson-invalid-json.xq 2013-07-11 06:16:30 +0000
@@ -1,6 +1,6 @@
1import module namespace json = "http://www.zorba-xquery.com/modules/converters/json";1import module namespace jx = "http://zorba.io/modules/json-xml";
22
3json:parse('[ "ul",3jx:json-to-xml('[ "ul",
4 [ "li", true],4 [ "li", true],
5 [ "li",5 [ "li",
6 {"href":"driving.html", "title":"Driving"},6 {"href":"driving.html", "title":"Driving"},
77
=== modified file 'test/rbkt/Queries/zorba/json/json-snelson-parse-array-01.xq'
--- test/rbkt/Queries/zorba/json/json-snelson-parse-array-01.xq 2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/json/json-snelson-parse-array-01.xq 2013-07-11 06:16:30 +0000
@@ -1,6 +1,6 @@
1import module namespace json = "http://www.zorba-xquery.com/modules/converters/json";1import module namespace jx = "http://zorba.io/modules/json-xml";
22
3let $json := '[ true ]'3let $json := '[ true ]'
4return json:parse( $json )4return jx:json-to-xml( $json )
55
6(: vim:set et sw=2 ts=2: :)6(: vim:set et sw=2 ts=2: :)
77
=== modified file 'test/rbkt/Queries/zorba/json/json-snelson-parse-array-02.xq'
--- test/rbkt/Queries/zorba/json/json-snelson-parse-array-02.xq 2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/json/json-snelson-parse-array-02.xq 2013-07-11 06:16:30 +0000
@@ -1,6 +1,6 @@
1import module namespace json = "http://www.zorba-xquery.com/modules/converters/json";1import module namespace jx = "http://zorba.io/modules/json-xml";
22
3let $json := '[ false ]'3let $json := '[ false ]'
4return json:parse( $json )4return jx:json-to-xml( $json )
55
6(: vim:set et sw=2 ts=2: :)6(: vim:set et sw=2 ts=2: :)
77
=== modified file 'test/rbkt/Queries/zorba/json/json-snelson-parse-array-03.xq'
--- test/rbkt/Queries/zorba/json/json-snelson-parse-array-03.xq 2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/json/json-snelson-parse-array-03.xq 2013-07-11 06:16:30 +0000
@@ -1,6 +1,6 @@
1import module namespace json = "http://www.zorba-xquery.com/modules/converters/json";1import module namespace jx = "http://zorba.io/modules/json-xml";
22
3let $json := '[ null ]'3let $json := '[ null ]'
4return json:parse( $json )4return jx:json-to-xml( $json )
55
6(: vim:set et sw=2 ts=2: :)6(: vim:set et sw=2 ts=2: :)
77
=== modified file 'test/rbkt/Queries/zorba/json/json-snelson-parse-array-04.xq'
--- test/rbkt/Queries/zorba/json/json-snelson-parse-array-04.xq 2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/json/json-snelson-parse-array-04.xq 2013-07-11 06:16:30 +0000
@@ -1,6 +1,6 @@
1import module namespace json = "http://www.zorba-xquery.com/modules/converters/json";1import module namespace jx = "http://zorba.io/modules/json-xml";
22
3let $json := '[ 1 ]'3let $json := '[ 1 ]'
4return json:parse( $json )4return jx:json-to-xml( $json )
55
6(: vim:set et sw=2 ts=2: :)6(: vim:set et sw=2 ts=2: :)
77
=== modified file 'test/rbkt/Queries/zorba/json/json-snelson-parse-array-05.xq'
--- test/rbkt/Queries/zorba/json/json-snelson-parse-array-05.xq 2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/json/json-snelson-parse-array-05.xq 2013-07-11 06:16:30 +0000
@@ -1,6 +1,6 @@
1import module namespace json = "http://www.zorba-xquery.com/modules/converters/json";1import module namespace jx = "http://zorba.io/modules/json-xml";
22
3let $json := '[ 1, 2 ]'3let $json := '[ 1, 2 ]'
4return json:parse( $json )4return jx:json-to-xml( $json )
55
6(: vim:set et sw=2 ts=2: :)6(: vim:set et sw=2 ts=2: :)
77
=== modified file 'test/rbkt/Queries/zorba/json/json-snelson-parse-array-06.xq'
--- test/rbkt/Queries/zorba/json/json-snelson-parse-array-06.xq 2012-01-26 01:35:11 +0000
+++ test/rbkt/Queries/zorba/json/json-snelson-parse-array-06.xq 2013-07-11 06:16:30 +0000
@@ -1,7 +1,7 @@
1(: parse a JSON array composed of 2 JSON objects :)1(: parse a JSON array composed of 2 JSON objects :)
22
3import module namespace json = "http://www.zorba-xquery.com/modules/converters/json";3import module namespace jx = "http://zorba.io/modules/json-xml";
44
5json:parse( '[ { "key1": "value1" }, { "key2": "value2" } ]' )5jx:json-to-xml( '[ { "key1": "value1" }, { "key2": "value2" } ]' )
66
7(: vim:set et sw=2 ts=2: :)7(: vim:set et sw=2 ts=2: :)
88
=== modified file 'test/rbkt/Queries/zorba/json/json-snelson-parse-array-07.xq'
--- test/rbkt/Queries/zorba/json/json-snelson-parse-array-07.xq 2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/json/json-snelson-parse-array-07.xq 2013-07-11 06:16:30 +0000
@@ -1,7 +1,7 @@
1(: parse an JSON array composed of 2 JSON arrays :)1(: parse an JSON array composed of 2 JSON arrays :)
22
3import module namespace json = "http://www.zorba-xquery.com/modules/converters/json";3import module namespace jx = "http://zorba.io/modules/json-xml";
44
5json:parse( '[ [ 11, 12 ], [ 21, 22 ] ]' )5jx:json-to-xml( '[ [ 11, 12 ], [ 21, 22 ] ]' )
66
7(: vim:se et sw=2 ts=2: :)7(: vim:se et sw=2 ts=2: :)
88
=== modified file 'test/rbkt/Queries/zorba/json/json-snelson-parse-array-08.xq'
--- test/rbkt/Queries/zorba/json/json-snelson-parse-array-08.xq 2012-02-08 01:15:26 +0000
+++ test/rbkt/Queries/zorba/json/json-snelson-parse-array-08.xq 2013-07-11 06:16:30 +0000
@@ -1,7 +1,7 @@
1import module namespace json =1import module namespace jx =
2 "http://www.zorba-xquery.com/modules/converters/json";2 "http://zorba.io/modules/json-xml";
33
4let $json := '[ 1, { "foo": "bar" } ]'4let $json := '[ 1, { "foo": "bar" } ]'
5return json:parse( $json )5return jx:json-to-xml( $json )
66
7(: vim:se et sw=2 ts=2: :)7(: vim:se et sw=2 ts=2: :)
88
=== modified file 'test/rbkt/Queries/zorba/json/json-snelson-parse-empty.xq'
--- test/rbkt/Queries/zorba/json/json-snelson-parse-empty.xq 2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/json/json-snelson-parse-empty.xq 2013-07-11 06:16:30 +0000
@@ -1,7 +1,7 @@
1(: try parsing an empty value :)1(: try parsing an empty value :)
22
3import module namespace json = "http://www.zorba-xquery.com/modules/converters/json";3import module namespace jx = "http://zorba.io/modules/json-xml";
44
5json:parse( <a/> )5jx:json-to-xml( <a/> )
66
7(: vim:se et sw=2 ts=2: :)7(: vim:se et sw=2 ts=2: :)
88
=== modified file 'test/rbkt/Queries/zorba/json/json-snelson-parse-example.xq'
--- test/rbkt/Queries/zorba/json/json-snelson-parse-example.xq 2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/json/json-snelson-parse-example.xq 2013-07-11 06:16:30 +0000
@@ -1,4 +1,4 @@
1import module namespace json = "http://www.zorba-xquery.com/modules/converters/json";1import module namespace jx = "http://zorba.io/modules/json-xml";
22
3let $json := '3let $json := '
4 {4 {
@@ -16,6 +16,6 @@
16 ]16 ]
17 }17 }
18 '18 '
19return json:parse( $json )19return jx:json-to-xml( $json )
2020
21(: vim:set et sw=2 ts=2: :)21(: vim:set et sw=2 ts=2: :)
2222
=== modified file 'test/rbkt/Queries/zorba/json/json-snelson-parse-numbers.xq'
--- test/rbkt/Queries/zorba/json/json-snelson-parse-numbers.xq 2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/json/json-snelson-parse-numbers.xq 2013-07-11 06:16:30 +0000
@@ -1,8 +1,8 @@
1(: json:parse testing numbers :)1(: jx:json-to-xml testing numbers :)
22
3import module namespace json = "http://www.zorba-xquery.com/modules/converters/json";3import module namespace jx = "http://zorba.io/modules/json-xml";
44
5json:parse( '{5jx:json-to-xml( '{
6 "decimal": 2.89,6 "decimal": 2.89,
7 "e": 2E+6,7 "e": 2E+6,
8 "negative": -1.898 "negative": -1.89
99
=== modified file 'test/rbkt/Queries/zorba/json/json-snelson-parse-object-01.xq'
--- test/rbkt/Queries/zorba/json/json-snelson-parse-object-01.xq 2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/json/json-snelson-parse-object-01.xq 2013-07-11 06:16:30 +0000
@@ -1,6 +1,6 @@
1import module namespace json = "http://www.zorba-xquery.com/modules/converters/json";1import module namespace jx = "http://zorba.io/modules/json-xml";
22
3let $json := '{ "a" : 1 }'3let $json := '{ "a" : 1 }'
4return json:parse( $json )4return jx:json-to-xml( $json )
55
6(: vim:set et sw=2 ts=2: :)6(: vim:set et sw=2 ts=2: :)
77
=== modified file 'test/rbkt/Queries/zorba/json/json-snelson-parse-object-02.xq'
--- test/rbkt/Queries/zorba/json/json-snelson-parse-object-02.xq 2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/json/json-snelson-parse-object-02.xq 2013-07-11 06:16:30 +0000
@@ -1,6 +1,6 @@
1import module namespace json = "http://www.zorba-xquery.com/modules/converters/json";1import module namespace jx = "http://zorba.io/modules/json-xml";
22
3let $json := '{ "a" : 1, "b" : 2 }'3let $json := '{ "a" : 1, "b" : 2 }'
4return json:parse( $json )4return jx:json-to-xml( $json )
55
6(: vim:set et sw=2 ts=2: :)6(: vim:set et sw=2 ts=2: :)
77
=== modified file 'test/rbkt/Queries/zorba/json/json-snelson-parse-object-03.xq'
--- test/rbkt/Queries/zorba/json/json-snelson-parse-object-03.xq 2012-02-08 15:45:53 +0000
+++ test/rbkt/Queries/zorba/json/json-snelson-parse-object-03.xq 2013-07-11 06:16:30 +0000
@@ -1,7 +1,7 @@
1import module namespace json =1import module namespace jx =
2 "http://www.zorba-xquery.com/modules/converters/json";2 "http://zorba.io/modules/json-xml";
33
4let $json := '{ "k1" : [ { "k2" : "v2" }, null ] }'4let $json := '{ "k1" : [ { "k2" : "v2" }, null ] }'
5return json:parse( $json )5return jx:json-to-xml( $json )
66
7(: vim:se et sw=2 ts=2: :)7(: vim:se et sw=2 ts=2: :)
88
=== modified file 'test/rbkt/Queries/zorba/json/json-snelson-parse-object-04.xq'
--- test/rbkt/Queries/zorba/json/json-snelson-parse-object-04.xq 2012-02-13 17:25:08 +0000
+++ test/rbkt/Queries/zorba/json/json-snelson-parse-object-04.xq 2013-07-11 06:16:30 +0000
@@ -1,5 +1,5 @@
1import module namespace json =1import module namespace jx =
2 "http://www.zorba-xquery.com/modules/converters/json";2 "http://zorba.io/modules/json-xml";
33
4let $json := '4let $json := '
5 {5 {
@@ -7,6 +7,6 @@
7 "key2": "value"7 "key2": "value"
8 }8 }
9'9'
10return json:parse( $json )10return jx:json-to-xml( $json )
1111
12(: vim:se et sw=2 ts=2: :)12(: vim:se et sw=2 ts=2: :)
1313
=== modified file 'test/rbkt/Queries/zorba/json/json-snelson-parse-object-05.xq'
--- test/rbkt/Queries/zorba/json/json-snelson-parse-object-05.xq 2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/json/json-snelson-parse-object-05.xq 2013-07-11 06:16:30 +0000
@@ -1,7 +1,7 @@
1(: json:parse testing null as a key value :)1(: jx:json-to-xml testing null as a key value :)
22
3import module namespace json = "http://www.zorba-xquery.com/modules/converters/json";3import module namespace jx = "http://zorba.io/modules/json-xml";
44
5json:parse( '{ "a" : null }' )5jx:json-to-xml( '{ "a" : null }' )
66
7(: vim:set et sw=2 ts=2: :)7(: vim:set et sw=2 ts=2: :)
88
=== modified file 'test/rbkt/Queries/zorba/json/json-snelson-parse-serialize.xq'
--- test/rbkt/Queries/zorba/json/json-snelson-parse-serialize.xq 2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/json/json-snelson-parse-serialize.xq 2013-07-11 06:16:30 +0000
@@ -1,10 +1,10 @@
1import module namespace json="http://www.zorba-xquery.com/modules/converters/json";1import module namespace jx="http://zorba.io/modules/json-xml";
22
3declare variable $json-element := 3declare variable $json-element :=
4<json xmlns="http://john.snelson.org.uk/parsing-json-into-xquery" type="object">4<json xmlns="http://john.snelson.org.uk/parsing-json-into-xquery" type="object">
5 <pair name="html" type="string">&lt;b&gt;bold&lt;/b&gt;</pair>5 <pair name="html" type="string">&lt;b&gt;bold&lt;/b&gt;</pair>
6</json>;6</json>;
77
8json:parse( json:serialize( $json-element ) )8jx:json-to-xml( jx:xml-to-json( $json-element ) )
99
10(: vim:se et sw=2 ts=2: :)10(: vim:se et sw=2 ts=2: :)
1111
=== modified file 'test/rbkt/Queries/zorba/json/json-snelson-parse-uncommon-chars.xq'
--- test/rbkt/Queries/zorba/json/json-snelson-parse-uncommon-chars.xq 2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/json/json-snelson-parse-uncommon-chars.xq 2013-07-11 06:16:30 +0000
@@ -1,7 +1,7 @@
1(: json:parse with uncommon characters :)1(: jx:json-to-xml with uncommon characters :)
22
3import module namespace json = "http://www.zorba-xquery.com/modules/converters/json";3import module namespace jx = "http://zorba.io/modules/json-xml";
44
5json:parse( '{ "web-app" : "!_\"-\\?*.$+" }' )5jx:json-to-xml( '{ "web-app" : "!_\"-\\?*.$+" }' )
66
7(: vim:se et sw=2 ts=2: :)7(: vim:se et sw=2 ts=2: :)
88
=== modified file 'test/rbkt/Queries/zorba/json/json-snelson-parse-utf8-01.xq'
--- test/rbkt/Queries/zorba/json/json-snelson-parse-utf8-01.xq 2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/json/json-snelson-parse-utf8-01.xq 2013-07-11 06:16:30 +0000
@@ -1,5 +1,5 @@
1(: try parsing a Unicode UTF-8 value :)1(: try parsing a Unicode UTF-8 value :)
22
3import module namespace json = "http://www.zorba-xquery.com/modules/converters/json";3import module namespace jx = "http://zorba.io/modules/json-xml";
44
5json:parse( '{ "mdash": "–" }' )5jx:json-to-xml( '{ "mdash": "–" }' )
66
=== modified file 'test/rbkt/Queries/zorba/json/json-snelson-serialize-array-01.xq'
--- test/rbkt/Queries/zorba/json/json-snelson-serialize-array-01.xq 2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/json/json-snelson-serialize-array-01.xq 2013-07-11 06:16:30 +0000
@@ -1,9 +1,9 @@
1import module namespace json = "http://www.zorba-xquery.com/modules/converters/json";1import module namespace jx = "http://zorba.io/modules/json-xml";
22
3let $json :=3let $json :=
4 <json type="array">4 <json type="array">
5 <item type="boolean">true</item>5 <item type="boolean">true</item>
6 </json>6 </json>
7return json:serialize( $json )7return jx:xml-to-json( $json )
88
9(: vim:set et sw=2 ts=2: :)9(: vim:set et sw=2 ts=2: :)
1010
=== modified file 'test/rbkt/Queries/zorba/json/json-snelson-serialize-array-02.xq'
--- test/rbkt/Queries/zorba/json/json-snelson-serialize-array-02.xq 2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/json/json-snelson-serialize-array-02.xq 2013-07-11 06:16:30 +0000
@@ -1,9 +1,9 @@
1import module namespace json = "http://www.zorba-xquery.com/modules/converters/json";1import module namespace jx = "http://zorba.io/modules/json-xml";
22
3let $json :=3let $json :=
4 <json type="array">4 <json type="array">
5 <item type="boolean">false</item>5 <item type="boolean">false</item>
6 </json>6 </json>
7return json:serialize( $json )7return jx:xml-to-json( $json )
88
9(: vim:set et sw=2 ts=2: :)9(: vim:set et sw=2 ts=2: :)
1010
=== modified file 'test/rbkt/Queries/zorba/json/json-snelson-serialize-array-03.xq'
--- test/rbkt/Queries/zorba/json/json-snelson-serialize-array-03.xq 2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/json/json-snelson-serialize-array-03.xq 2013-07-11 06:16:30 +0000
@@ -1,9 +1,9 @@
1import module namespace json = "http://www.zorba-xquery.com/modules/converters/json";1import module namespace jx = "http://zorba.io/modules/json-xml";
22
3let $json :=3let $json :=
4 <json type="array">4 <json type="array">
5 <item type="null"/>5 <item type="null"/>
6 </json>6 </json>
7return json:serialize( $json )7return jx:xml-to-json( $json )
88
9(: vim:set et sw=2 ts=2: :)9(: vim:set et sw=2 ts=2: :)
1010
=== modified file 'test/rbkt/Queries/zorba/json/json-snelson-serialize-array-04.xq'
--- test/rbkt/Queries/zorba/json/json-snelson-serialize-array-04.xq 2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/json/json-snelson-serialize-array-04.xq 2013-07-11 06:16:30 +0000
@@ -1,9 +1,9 @@
1import module namespace json = "http://www.zorba-xquery.com/modules/converters/json";1import module namespace jx = "http://zorba.io/modules/json-xml";
22
3let $json :=3let $json :=
4 <json type="array">4 <json type="array">
5 <item type="number">1</item>5 <item type="number">1</item>
6 </json>6 </json>
7return json:serialize( $json )7return jx:xml-to-json( $json )
88
9(: vim:set et sw=2 ts=2: :)9(: vim:set et sw=2 ts=2: :)
1010
=== modified file 'test/rbkt/Queries/zorba/json/json-snelson-serialize-array-05.xq'
--- test/rbkt/Queries/zorba/json/json-snelson-serialize-array-05.xq 2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/json/json-snelson-serialize-array-05.xq 2013-07-11 06:16:30 +0000
@@ -1,10 +1,10 @@
1import module namespace json = "http://www.zorba-xquery.com/modules/converters/json";1import module namespace jx = "http://zorba.io/modules/json-xml";
22
3let $json :=3let $json :=
4 <json type="array">4 <json type="array">
5 <item type="number">1</item>5 <item type="number">1</item>
6 <item type="number">2</item>6 <item type="number">2</item>
7 </json>7 </json>
8return json:serialize( $json )8return jx:xml-to-json( $json )
99
10(: vim:set et sw=2 ts=2: :)10(: vim:set et sw=2 ts=2: :)
1111
=== modified file 'test/rbkt/Queries/zorba/json/json-snelson-serialize-array-06.xq'
--- test/rbkt/Queries/zorba/json/json-snelson-serialize-array-06.xq 2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/json/json-snelson-serialize-array-06.xq 2013-07-11 06:16:30 +0000
@@ -1,9 +1,9 @@
1import module namespace json = "http://www.zorba-xquery.com/modules/converters/json";1import module namespace jx = "http://zorba.io/modules/json-xml";
22
3let $json :=3let $json :=
4 <json type="array">4 <json type="array">
5 <foo type="boolean">true</foo>5 <foo type="boolean">true</foo>
6 </json>6 </json>
7return json:serialize( $json )7return jx:xml-to-json( $json )
88
9(: vim:set et sw=2 ts=2: :)9(: vim:set et sw=2 ts=2: :)
1010
=== modified file 'test/rbkt/Queries/zorba/json/json-snelson-serialize-array-07.xq'
--- test/rbkt/Queries/zorba/json/json-snelson-serialize-array-07.xq 2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/json/json-snelson-serialize-array-07.xq 2013-07-11 06:16:30 +0000
@@ -1,9 +1,9 @@
1import module namespace json = "http://www.zorba-xquery.com/modules/converters/json";1import module namespace jx = "http://zorba.io/modules/json-xml";
22
3let $json :=3let $json :=
4 <json type="array">4 <json type="array">
5 <item type="boolean">foo</item>5 <item type="boolean">foo</item>
6 </json>6 </json>
7return json:serialize( $json )7return jx:xml-to-json( $json )
88
9(: vim:set et sw=2 ts=2: :)9(: vim:set et sw=2 ts=2: :)
1010
=== modified file 'test/rbkt/Queries/zorba/json/json-snelson-serialize-array-08.xq'
--- test/rbkt/Queries/zorba/json/json-snelson-serialize-array-08.xq 2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/json/json-snelson-serialize-array-08.xq 2013-07-11 06:16:30 +0000
@@ -1,9 +1,9 @@
1import module namespace json = "http://www.zorba-xquery.com/modules/converters/json";1import module namespace jx = "http://zorba.io/modules/json-xml";
22
3let $json :=3let $json :=
4 <json type="array">4 <json type="array">
5 <item>false</item>5 <item>false</item>
6 </json>6 </json>
7return json:serialize( $json )7return jx:xml-to-json( $json )
88
9(: vim:set et sw=2 ts=2: :)9(: vim:set et sw=2 ts=2: :)
1010
=== modified file 'test/rbkt/Queries/zorba/json/json-snelson-serialize-array-09.xq'
--- test/rbkt/Queries/zorba/json/json-snelson-serialize-array-09.xq 2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/json/json-snelson-serialize-array-09.xq 2013-07-11 06:16:30 +0000
@@ -1,9 +1,9 @@
1import module namespace json = "http://www.zorba-xquery.com/modules/converters/json";1import module namespace jx = "http://zorba.io/modules/json-xml";
22
3let $json :=3let $json :=
4 <json type="array">4 <json type="array">
5 <item type="bool">false</item>5 <item type="bool">false</item>
6 </json>6 </json>
7return json:serialize( $json )7return jx:xml-to-json( $json )
88
9(: vim:set et sw=2 ts=2: :)9(: vim:set et sw=2 ts=2: :)
1010
=== modified file 'test/rbkt/Queries/zorba/json/json-snelson-serialize-array-10.xq'
--- test/rbkt/Queries/zorba/json/json-snelson-serialize-array-10.xq 2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/json/json-snelson-serialize-array-10.xq 2013-07-11 06:16:30 +0000
@@ -1,9 +1,9 @@
1import module namespace json = "http://www.zorba-xquery.com/modules/converters/json";1import module namespace jx = "http://zorba.io/modules/json-xml";
22
3let $json :=3let $json :=
4 <json type="array">4 <json type="array">
5 hello5 hello
6 </json>6 </json>
7return json:serialize( $json )7return jx:xml-to-json( $json )
88
9(: vim:set et sw=2 ts=2: :)9(: vim:set et sw=2 ts=2: :)
1010
=== modified file 'test/rbkt/Queries/zorba/json/json-snelson-serialize-array-11.xq'
--- test/rbkt/Queries/zorba/json/json-snelson-serialize-array-11.xq 2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/json/json-snelson-serialize-array-11.xq 2013-07-11 06:16:30 +0000
@@ -1,9 +1,9 @@
1import module namespace json = "http://www.zorba-xquery.com/modules/converters/json";1import module namespace jx = "http://zorba.io/modules/json-xml";
22
3let $json :=3let $json :=
4 <json type="array">4 <json type="array">
5 <item type="boolean"><foo/></item>5 <item type="boolean"><foo/></item>
6 </json>6 </json>
7return json:serialize( $json )7return jx:xml-to-json( $json )
88
9(: vim:set et sw=2 ts=2: :)9(: vim:set et sw=2 ts=2: :)
1010
=== modified file 'test/rbkt/Queries/zorba/json/json-snelson-serialize-array-12.xq'
--- test/rbkt/Queries/zorba/json/json-snelson-serialize-array-12.xq 2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/json/json-snelson-serialize-array-12.xq 2013-07-11 06:16:30 +0000
@@ -1,12 +1,12 @@
1(: valid json generation: comments should be ignored :)1(: valid json generation: comments should be ignored :)
22
3import module namespace json = "http://www.zorba-xquery.com/modules/converters/json";3import module namespace jx = "http://zorba.io/modules/json-xml";
44
5let $json :=5let $json :=
6 <json type="array">6 <json type="array">
7 <!--comment-->7 <!--comment-->
8 <item type="boolean">true</item>8 <item type="boolean">true</item>
9 </json>9 </json>
10return json:serialize( $json )10return jx:xml-to-json( $json )
1111
12(: vim:set et sw=2 ts=2: :)12(: vim:set et sw=2 ts=2: :)
1313
=== modified file 'test/rbkt/Queries/zorba/json/json-snelson-serialize-comment-node.xq'
--- test/rbkt/Queries/zorba/json/json-snelson-serialize-comment-node.xq 2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/json/json-snelson-serialize-comment-node.xq 2013-07-11 06:16:30 +0000
@@ -1,6 +1,6 @@
1import module namespace json = "http://www.zorba-xquery.com/modules/converters/json";1import module namespace jx = "http://zorba.io/modules/json-xml";
22
3let $json := <!--comment--> 3let $json := <!--comment-->
4return json:serialize( $json )4return jx:xml-to-json( $json )
55
6(: vim:set et sw=2 ts=2: :)6(: vim:set et sw=2 ts=2: :)
77
=== modified file 'test/rbkt/Queries/zorba/json/json-snelson-serialize-indent-example.xq'
--- test/rbkt/Queries/zorba/json/json-snelson-serialize-indent-example.xq 2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/json/json-snelson-serialize-indent-example.xq 2013-07-11 06:16:30 +0000
@@ -1,4 +1,4 @@
1import module namespace json = "http://www.zorba-xquery.com/modules/converters/json";1import module namespace jx = "http://zorba.io/modules/json-xml";
22
3let $json :=3let $json :=
4 <json type="object">4 <json type="object">
@@ -15,11 +15,7 @@
15 <item type="string">646 123-4567</item>15 <item type="string">646 123-4567</item>
16 </pair>16 </pair>
17 </json>17 </json>
18let $options :=18let $options := { "json-format" : "Snelson", "whitespace" : "indent" }
19 <options xmlns="http://www.zorba-xquery.com/modules/converters/json-options">19return jx:xml-to-json( $json, $options )
20 <json-format value="Snelson"/>
21 <whitespace value="indent"/>
22 </options>
23return json:serialize( $json, $options )
2420
25(: vim:set et sw=2 ts=2: :)21(: vim:set et sw=2 ts=2: :)
2622
=== modified file 'test/rbkt/Queries/zorba/json/json-snelson-serialize-invalid-value-for-attribute.xq'
--- test/rbkt/Queries/zorba/json/json-snelson-serialize-invalid-value-for-attribute.xq 2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/json/json-snelson-serialize-invalid-value-for-attribute.xq 2013-07-11 06:16:30 +0000
@@ -1,9 +1,9 @@
1import module namespace json = "http://www.zorba-xquery.com/modules/converters/json";1import module namespace jx = "http://zorba.io/modules/json-xml";
22
3let $json := 3let $json :=
4<json xmlns="http://john.snelson.org.uk/parsing-json-into-xquery" type="object">4<json xmlns="http://john.snelson.org.uk/parsing-json-into-xquery" type="object">
5 <pair name="a" type="nothing">a</pair>5 <pair name="a" type="nothing">a</pair>
6</json>6</json>
7return json:serialize( $json )7return jx:xml-to-json( $json )
88
9(: vim:set et sw=2 ts=2: :)9(: vim:set et sw=2 ts=2: :)
1010
=== modified file 'test/rbkt/Queries/zorba/json/json-snelson-serialize-none-example.xq'
--- test/rbkt/Queries/zorba/json/json-snelson-serialize-none-example.xq 2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/json/json-snelson-serialize-none-example.xq 2013-07-11 06:16:30 +0000
@@ -1,4 +1,4 @@
1import module namespace json = "http://www.zorba-xquery.com/modules/converters/json";1import module namespace jx = "http://zorba.io/modules/json-xml";
22
3let $json :=3let $json :=
4 <json type="object">4 <json type="object">
@@ -15,6 +15,6 @@
15 <item type="string">646 123-4567</item>15 <item type="string">646 123-4567</item>
16 </pair>16 </pair>
17 </json>17 </json>
18return json:serialize( $json )18return jx:xml-to-json( $json )
1919
20(: vim:set et sw=2 ts=2: :)20(: vim:set et sw=2 ts=2: :)
2121
=== modified file 'test/rbkt/Queries/zorba/json/json-snelson-serialize-object-01.xq'
--- test/rbkt/Queries/zorba/json/json-snelson-serialize-object-01.xq 2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/json/json-snelson-serialize-object-01.xq 2013-07-11 06:16:30 +0000
@@ -1,9 +1,9 @@
1import module namespace json = "http://www.zorba-xquery.com/modules/converters/json";1import module namespace jx = "http://zorba.io/modules/json-xml";
22
3let $json :=3let $json :=
4 <json type="object">4 <json type="object">
5 <pair name="a" type="number">1</pair>5 <pair name="a" type="number">1</pair>
6 </json>6 </json>
7return json:serialize( $json )7return jx:xml-to-json( $json )
88
9(: vim:set et sw=2 ts=2: :)9(: vim:set et sw=2 ts=2: :)
1010
=== modified file 'test/rbkt/Queries/zorba/json/json-snelson-serialize-object-02.xq'
--- test/rbkt/Queries/zorba/json/json-snelson-serialize-object-02.xq 2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/json/json-snelson-serialize-object-02.xq 2013-07-11 06:16:30 +0000
@@ -1,10 +1,10 @@
1import module namespace json = "http://www.zorba-xquery.com/modules/converters/json";1import module namespace jx = "http://zorba.io/modules/json-xml";
22
3let $json :=3let $json :=
4 <json type="object">4 <json type="object">
5 <pair name="a" type="number">1</pair>5 <pair name="a" type="number">1</pair>
6 <pair name="b" type="number">2</pair>6 <pair name="b" type="number">2</pair>
7 </json>7 </json>
8return json:serialize( $json )8return jx:xml-to-json( $json )
99
10(: vim:set et sw=2 ts=2: :)10(: vim:set et sw=2 ts=2: :)
1111
=== modified file 'test/rbkt/Queries/zorba/json/json-snelson-serialize-object-03.xq'
--- test/rbkt/Queries/zorba/json/json-snelson-serialize-object-03.xq 2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/json/json-snelson-serialize-object-03.xq 2013-07-11 06:16:30 +0000
@@ -1,6 +1,6 @@
1(: valid json generation: comments should be ignored :)1(: valid json generation: comments should be ignored :)
22
3import module namespace json = "http://www.zorba-xquery.com/modules/converters/json";3import module namespace jx = "http://zorba.io/modules/json-xml";
44
5let $json :=5let $json :=
6 <json type="object">6 <json type="object">
@@ -8,6 +8,6 @@
8 <pair name="a" type="number">1</pair>8 <pair name="a" type="number">1</pair>
9 <!--comment-->9 <!--comment-->
10 </json>10 </json>
11return json:serialize( $json )11return jx:xml-to-json( $json )
1212
13(: vim:set et sw=2 ts=2: :)13(: vim:set et sw=2 ts=2: :)
1414
=== modified file 'test/rbkt/Queries/zorba/json/json-snelson-serialize-parse.xq'
--- test/rbkt/Queries/zorba/json/json-snelson-serialize-parse.xq 2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/json/json-snelson-serialize-parse.xq 2013-07-11 06:16:30 +0000
@@ -1,7 +1,7 @@
1import module namespace json="http://www.zorba-xquery.com/modules/converters/json";1import module namespace jx="http://zorba.io/modules/json-xml";
22
3declare variable $json-value := '{ "key" : "value" }';3declare variable $json-value := '{ "key" : "value" }';
44
5json:serialize( json:parse( $json-value ) )5jx:xml-to-json( jx:json-to-xml( $json-value ) )
66
7(: vim:se et sw=2 ts=2: :)7(: vim:se et sw=2 ts=2: :)
88
=== modified file 'test/rbkt/Queries/zorba/json/json-snelson-serialize-some-example.xq'
--- test/rbkt/Queries/zorba/json/json-snelson-serialize-some-example.xq 2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/json/json-snelson-serialize-some-example.xq 2013-07-11 06:16:30 +0000
@@ -1,4 +1,4 @@
1import module namespace json = "http://www.zorba-xquery.com/modules/converters/json";1import module namespace jx = "http://zorba.io/modules/json-xml";
22
3let $json :=3let $json :=
4 <json type="object">4 <json type="object">
@@ -15,11 +15,7 @@
15 <item type="string">646 123-4567</item>15 <item type="string">646 123-4567</item>
16 </pair>16 </pair>
17 </json>17 </json>
18let $options :=18let $options := { "json-format" : "Snelson", "whitespace" : "some" }
19 <options xmlns="http://www.zorba-xquery.com/modules/converters/json-options">19return jx:xml-to-json( $json, $options )
20 <json-format value="Snelson"/>
21 <whitespace value="some"/>
22 </options>
23return json:serialize( $json, $options )
2420
25(: vim:set et sw=2 ts=2: :)21(: vim:set et sw=2 ts=2: :)
2622
=== modified file 'test/rbkt/Queries/zorba/json/json-snelson-serialize-type-value-missing.xq'
--- test/rbkt/Queries/zorba/json/json-snelson-serialize-type-value-missing.xq 2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/json/json-snelson-serialize-type-value-missing.xq 2013-07-11 06:16:30 +0000
@@ -1,9 +1,9 @@
1import module namespace json = "http://www.zorba-xquery.com/modules/converters/json";1import module namespace jx = "http://zorba.io/modules/json-xml";
22
3let $json := 3let $json :=
4<json xmlns="http://john.snelson.org.uk/parsing-json-into-xquery" type="object">4<json xmlns="http://john.snelson.org.uk/parsing-json-into-xquery" type="object">
5 <pair name="a">a</pair>5 <pair name="a">a</pair>
6</json>6</json>
7return json:serialize( $json )7return jx:xml-to-json( $json )
88
9(: vim:set et sw=2 ts=2: :)9(: vim:set et sw=2 ts=2: :)
1010
=== modified file 'test/update/Queries/zorba/store/sc3_ex3.xq'
--- test/update/Queries/zorba/store/sc3_ex3.xq 2013-02-07 17:24:36 +0000
+++ test/update/Queries/zorba/store/sc3_ex3.xq 2013-07-11 06:16:30 +0000
@@ -1,10 +1,8 @@
1import module namespace doc = "http://www.zorba-xquery.com/modules/store/dynamic/documents";1import module namespace doc = "http://www.zorba-xquery.com/modules/store/dynamic/documents";
22
3import module namespace j = "http://www.zorba-xquery.com/modules/converters/json";3import module namespace j = "http://zorba.io/modules/json-xml";
44
5j:serialize(5j:xml-to-json(
6 doc:document("meat_poultry.xml")/root/row,6 doc:document("meat_poultry.xml")/root/row,
7 <options xmlns="http://www.zorba-xquery.com/modules/converters/json-options" >7 { "json-format" : "JsonML-array" }
8 <json-format value="JsonML-array" />
9 </options>
10)8)

Subscribers

People subscribed via source and target branches