Merge lp:~zorba-coders/zorba/bug-1055608-node-kinds-for-roundtrip into lp:zorba

Proposed by Till Westmann
Status: Merged
Approved by: Till Westmann
Approved revision: 11071
Merged at revision: 11079
Proposed branch: lp:~zorba-coders/zorba/bug-1055608-node-kinds-for-roundtrip
Merge into: lp:zorba
Diff against target: 372 lines (+196/-47)
13 files modified
src/runtime/json/jsoniq_functions_impl.cpp (+150/-41)
src/runtime/json/pregenerated/jsoniq_functions.h (+2/-0)
src/runtime/spec/json/jsoniq_functions.xml (+12/-0)
test/rbkt/ExpQueryResults/zorba/jsoniq/jn_accumulate.xml.res (+1/-1)
test/rbkt/ExpQueryResults/zorba/jsoniq/obj_constr_02.xml.res (+1/-1)
test/rbkt/ExpQueryResults/zorba/jsoniq/obj_constr_04.xml.res (+1/-1)
test/rbkt/ExpQueryResults/zorba/jsoniq/roundtrip/encode_03.xml.res (+1/-1)
test/rbkt/ExpQueryResults/zorba/jsoniq/roundtrip/encode_04.xml.res (+1/-1)
test/rbkt/ExpQueryResults/zorba/jsoniq/roundtrip/encode_10.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/jsoniq/roundtrip/roundtrip_03.xml.res (+1/-1)
test/rbkt/ExpQueryResults/zorba/jsoniq/roundtrip/roundtrip_06.xml.res (+2/-0)
test/rbkt/Queries/zorba/jsoniq/roundtrip/encode_10.xq (+8/-0)
test/rbkt/Queries/zorba/jsoniq/roundtrip/roundtrip_06.xq (+15/-0)
To merge this branch: bzr merge lp:~zorba-coders/zorba/bug-1055608-node-kinds-for-roundtrip
Reviewer Review Type Date Requested Status
Ghislain Fourny Approve
Matthias Brantner Approve
Review via email: mp+126590@code.launchpad.net

Commit message

use XDM node kinds in encode-for-roundtrip

Description of the change

use XDM node kinds in encode-for-roundtrip

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 :

The attempt to merge lp:~zorba-coders/zorba/bug-1055608-node-kinds-for-roundtrip into lp:zorba failed. Below is the output from the failed tests.

CMake Error at /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake:274 (message):
  Validation queue job
  bug-1055608-node-kinds-for-roundtrip-2012-09-27T02-17-43.713Z is finished.
  The final status was:

  3 tests did not succeed - changes not commited.

Error in read script: /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake

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

Validation queue job bug-1055608-node-kinds-for-roundtrip-2012-09-27T03-36-39.765Z is finished. The final status was:

All tests succeeded!

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

Voting does not meet specified criteria. Required: Approve > 1, Disapprove < 1, Needs Fixing < 1, Pending < 1. Got: 2 Pending.

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

Validation queue job bug-1055608-node-kinds-for-roundtrip-2012-09-27T05-41-43.261Z is finished. The final status was:

All tests succeeded!

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

Voting does not meet specified criteria. Required: Approve > 1, Disapprove < 1, Needs Fixing < 1, Pending < 1. Got: 2 Pending.

Revision history for this message
Matthias Brantner (matthias-brantner) :
review: Approve
Revision history for this message
Ghislain Fourny (gislenius) wrote :

Looks good, but there is a typo :-) (s/instauction/instruction).

review: Approve
Revision history for this message
Till Westmann (tillw) wrote :

> Looks good, but there is a typo :-) (s/instauction/instruction).

fixed. Thanks!

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

The attempt to merge lp:~zorba-coders/zorba/bug-1055608-node-kinds-for-roundtrip into lp:zorba failed. Below is the output from the failed tests.

CMake Error at /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake:274 (message):
  Validation queue job
  bug-1055608-node-kinds-for-roundtrip-2012-10-01T16-23-54.914Z is finished.
  The final status was:

  1 tests did not succeed - changes not commited.

Error in read script: /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake

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

The attempt to merge lp:~zorba-coders/zorba/bug-1055608-node-kinds-for-roundtrip into lp:zorba failed. Below is the output from the failed tests.

CMake Error at /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake:274 (message):
  Validation queue job
  bug-1055608-node-kinds-for-roundtrip-2012-10-01T17-12-56.025Z is finished.
  The final status was:

  1 tests did not succeed - changes not commited.

Error in read script: /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake

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

The attempt to merge lp:~zorba-coders/zorba/bug-1055608-node-kinds-for-roundtrip into lp:zorba failed. Below is the output from the failed tests.

CMake Error at /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake:274 (message):
  Validation queue job
  bug-1055608-node-kinds-for-roundtrip-2012-10-01T21-33-01.981Z is finished.
  The final status was:

  1 tests did not succeed - changes not commited.

Error in read script: /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake

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

Validation queue job bug-1055608-node-kinds-for-roundtrip-2012-10-02T11-24-30.174Z is finished. The final status was:

All tests succeeded!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/runtime/json/jsoniq_functions_impl.cpp'
2--- src/runtime/json/jsoniq_functions_impl.cpp 2012-09-24 17:11:12 +0000
3+++ src/runtime/json/jsoniq_functions_impl.cpp 2012-10-01 16:22:23 +0000
4@@ -1,12 +1,12 @@
5 /*
6 * Copyright 2006-2008 The FLWOR Foundation.
7- *
8+ *
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
12- *
13+ *
14 * http://www.apache.org/licenses/LICENSE-2.0
15- *
16+ *
17 * Unless required by applicable law or agreed to in writing, software
18 * distributed under the License is distributed on an "AS IS" BASIS,
19 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20@@ -67,6 +67,72 @@
21 const char * OPTIONS_KEY_PREFIX = "prefix";
22 const char * OPTIONS_KEY_SER_PARAMS = "serialization-parameters";
23
24+const char * SEQTYPE_ANYNODE = "node()";
25+const char * SEQTYPE_COMMENT = "comment()";
26+const char * SEQTYPE_DOCUMENT = "document-node()";
27+const char * SEQTYPE_ELEMENT = "element()";
28+const char * SEQTYPE_PROCINST = "processing-instruction()";
29+const char * SEQTYPE_TEXT = "text()";
30+
31+const char * kind2str(const store::NodeKind& aKind)
32+{
33+ // we do not support attibutes and namespaces as they cannot be serialized
34+ switch (aKind)
35+ {
36+ case store::StoreConsts::anyNode: return SEQTYPE_ANYNODE;
37+ case store::StoreConsts::commentNode: return SEQTYPE_COMMENT;
38+ case store::StoreConsts::documentNode: return SEQTYPE_DOCUMENT;
39+ case store::StoreConsts::elementNode: return SEQTYPE_ELEMENT;
40+ case store::StoreConsts::piNode: return SEQTYPE_PROCINST;
41+ case store::StoreConsts::textNode: return SEQTYPE_TEXT;
42+ default: return "";
43+ }
44+}
45+
46+bool str2kind(const zstring& aString, store::NodeKind& aKind)
47+{
48+ switch(aString.at(0))
49+ {
50+ case 'c':
51+ if (aString == SEQTYPE_COMMENT)
52+ {
53+ aKind = store::StoreConsts::commentNode;
54+ return true;
55+ }
56+ break;
57+ case 'd':
58+ if (aString == SEQTYPE_DOCUMENT)
59+ {
60+ aKind = store::StoreConsts::documentNode;
61+ return true;
62+ }
63+ break;
64+ case 'e':
65+ case 'n': // "node()" maps to element for backwards compatibility
66+ if (aString == SEQTYPE_ELEMENT || aString == SEQTYPE_ANYNODE)
67+ {
68+ aKind = store::StoreConsts::elementNode;
69+ return true;
70+ }
71+ break;
72+ case 'p':
73+ if (aString == SEQTYPE_PROCINST)
74+ {
75+ aKind = store::StoreConsts::piNode;
76+ return true;
77+ }
78+ break;
79+ case 't':
80+ if (aString == SEQTYPE_TEXT)
81+ {
82+ aKind = store::StoreConsts::textNode;
83+ return true;
84+ }
85+ break;
86+ }
87+ return false;
88+}
89+
90 /*******************************************************************************
91 json:decode-from-roundtrip($items as json-item()*,
92 $options as object()) as structured-item()*
93@@ -97,6 +163,82 @@
94 }
95 }
96
97+void
98+JSONDecodeFromRoundtripIterator::extractChildOfKind(
99+ const store::Item_t& aParent,
100+ const store::NodeKind& aKind,
101+ store::Item_t& aChild)
102+{
103+ store::Iterator_t lIt = aParent->getChildren();
104+ bool lFound = false;
105+ lIt->open();
106+ while (! lFound && lIt->next(aChild))
107+ {
108+ lFound = aChild->getNodeKind() == aKind;
109+ }
110+ lIt->close();
111+ ZORBA_ASSERT(lFound);
112+}
113+
114+bool
115+JSONDecodeFromRoundtripIterator::decodeNode(
116+ const store::Item_t& aSerializedNode,
117+ const store::NodeKind& aKind,
118+ store::Item_t& aResult) const
119+{
120+ store::LoadProperties lProperties;
121+ lProperties.setStoreDocument(false);
122+ store::Item_t lDoc;
123+ zstring lXmlString;
124+ switch (aKind)
125+ {
126+ case store::StoreConsts::commentNode:
127+ case store::StoreConsts::piNode:
128+ case store::StoreConsts::textNode:
129+ {
130+ // we have to wrap these 3 node kinds, so we cannot care about streams
131+ aSerializedNode->getStringValue2(lXmlString);
132+ lXmlString = "<a>" + lXmlString + "</a>";
133+ std::istringstream lStream(lXmlString.c_str());
134+ lDoc = GENV.getStore().loadDocument("", "", lStream, lProperties);
135+ }
136+ break;
137+ default:
138+ if (aSerializedNode->isStreamable())
139+ {
140+ lDoc = GENV.getStore().loadDocument(
141+ "", "", aSerializedNode->getStream(), lProperties);
142+ }
143+ else
144+ {
145+ aSerializedNode->getStringValue2(lXmlString);
146+ std::istringstream lStream(lXmlString.c_str());
147+ lDoc = GENV.getStore().loadDocument("", "", lStream, lProperties);
148+ }
149+ break;
150+ }
151+ if (aKind == store::StoreConsts::documentNode)
152+ {
153+ aResult = lDoc;
154+ }
155+ else
156+ {
157+ store::Item_t lRootElem;
158+ extractChildOfKind(lDoc, store::StoreConsts::elementNode, lRootElem);
159+ if (aKind == store::StoreConsts::elementNode)
160+ {
161+ // if we needed an element we're done
162+ aResult = lRootElem;
163+ }
164+ else
165+ {
166+ // otherwise we have to pass through the wrapper that we've created
167+ extractChildOfKind(lRootElem, aKind, aResult);
168+ }
169+ }
170+ return true;
171+}
172+
173 bool
174 JSONDecodeFromRoundtripIterator::decodeXDM(
175 const store::Item_t& anObj,
176@@ -125,32 +267,10 @@
177
178 zstring lTypeNameString;
179 lTypeValueItem->getStringValue2(lTypeNameString);
180- if (lTypeNameString == "node()")
181+ store::NodeKind lNodeKind;
182+ if (str2kind(lTypeNameString, lNodeKind))
183 {
184- store::LoadProperties lProperties;
185- lProperties.setStoreDocument(false);
186- store::Item_t lDoc;
187- if (lValueValueItem->isStreamable())
188- {
189- lDoc = GENV.getStore().loadDocument(
190- "", "", lValueValueItem->getStream(), lProperties);
191- }
192- else
193- {
194- zstring lXmlString;
195- lValueValueItem->getStringValue2(lXmlString);
196- std::istringstream lStream(lXmlString.c_str());
197- lDoc = GENV.getStore().loadDocument("", "", lStream, lProperties);
198- }
199- store::Iterator_t lIt = lDoc->getChildren();
200- bool lFound = false;
201- lIt->open();
202- while (! lFound && lIt->next(aResult))
203- {
204- lFound = aResult->getNodeKind() == store::StoreConsts::elementNode;
205- }
206- lIt->close();
207- ZORBA_ASSERT(lFound);
208+ return decodeNode(lValueValueItem, lNodeKind, aResult);
209 }
210 else
211 {
212@@ -184,8 +304,8 @@
213 &lTmpNsCtx,
214 loc);
215 }
216+ return true;
217 }
218- return true;
219 }
220
221 bool
222@@ -478,23 +598,12 @@
223 store::Item_t& aResult,
224 JSONEncodeForRoundtripIteratorState* aState) const
225 {
226- if (aNode->getNodeKind() != store::StoreConsts::elementNode)
227- {
228- // this is a temporary solution until we decide if/how we encode
229- // node kinds
230- RAISE_ERROR(
231- zerr::ZXQP0004_NOT_IMPLEMENTED,
232- loc,
233- ERROR_PARAMS(store::StoreConsts::toString(aNode->getNodeKind()))
234- );
235- }
236-
237 std::vector<store::Item_t> names(2);
238 std::vector<store::Item_t> values(2);
239
240 {
241 zstring typeKey = aState->thePrefix + TYPE_KEY;
242- zstring typeValue = "node()";
243+ zstring typeValue = kind2str(aNode->getNodeKind());
244 GENV_ITEMFACTORY->createString(names.at(0), typeKey);
245 GENV_ITEMFACTORY->createString(values.at(0), typeValue);
246 }
247
248=== modified file 'src/runtime/json/pregenerated/jsoniq_functions.h'
249--- src/runtime/json/pregenerated/jsoniq_functions.h 2012-09-24 09:17:44 +0000
250+++ src/runtime/json/pregenerated/jsoniq_functions.h 2012-10-01 16:22:23 +0000
251@@ -72,6 +72,8 @@
252 virtual ~JSONDecodeFromRoundtripIterator();
253
254 public:
255+ static void extractChildOfKind(const store::Item_t& aParent, const store::NodeKind& aKind, store::Item_t& aChild);
256+ bool decodeNode(const store::Item_t& aSerializedNode, const store::NodeKind& aKind, store::Item_t& aResult) const;
257 bool decodeXDM(const store::Item_t& anObj, store::Item_t& aResult, JSONDecodeFromRoundtripIteratorState* aState) const;
258 bool decodeObject(const store::Item_t& anObj, store::Item_t& aResult, JSONDecodeFromRoundtripIteratorState* aState) const;
259 bool decodeArray(const store::Item_t& anArray, store::Item_t& aResult, JSONDecodeFromRoundtripIteratorState* aState) const;
260
261=== modified file 'src/runtime/spec/json/jsoniq_functions.xml'
262--- src/runtime/spec/json/jsoniq_functions.xml 2012-09-21 19:01:00 +0000
263+++ src/runtime/spec/json/jsoniq_functions.xml 2012-10-01 16:22:23 +0000
264@@ -40,6 +40,18 @@
265 <zorba:member type="zstring" name="thePrefix" brief=""/>
266 </zorba:state>
267
268+ <zorba:method static="true" name="extractChildOfKind" return="void">
269+ <zorba:param type="const store::Item_t&amp;" name="aParent"/>
270+ <zorba:param type="const store::NodeKind&amp;" name="aKind"/>
271+ <zorba:param type="store::Item_t&amp;" name="aChild"/>
272+ </zorba:method>
273+
274+ <zorba:method const="true" name="decodeNode" return="bool">
275+ <zorba:param type="const store::Item_t&amp;" name="aSerializedNode"/>
276+ <zorba:param type="const store::NodeKind&amp;" name="aKind"/>
277+ <zorba:param type="store::Item_t&amp;" name="aResult"/>
278+ </zorba:method>
279+
280 <zorba:method const="true" name="decodeXDM" return="bool">
281 <zorba:param type="const store::Item_t&amp;" name="anObj"/>
282 <zorba:param type="store::Item_t&amp;" name="aResult"/>
283
284=== modified file 'test/rbkt/ExpQueryResults/zorba/jsoniq/jn_accumulate.xml.res'
285--- test/rbkt/ExpQueryResults/zorba/jsoniq/jn_accumulate.xml.res 2012-09-15 01:17:21 +0000
286+++ test/rbkt/ExpQueryResults/zorba/jsoniq/jn_accumulate.xml.res 2012-10-01 16:22:23 +0000
287@@ -1,1 +1,1 @@
288-{ "n1" : { "type" : "node()", "value" : "<node>10</node>" }, "n2" : { "type" : "node()", "value" : "<node>20</node>" } }
289+{ "n1" : { "type" : "element()", "value" : "<node>10</node>" }, "n2" : { "type" : "element()", "value" : "<node>20</node>" } }
290
291=== modified file 'test/rbkt/ExpQueryResults/zorba/jsoniq/obj_constr_02.xml.res'
292--- test/rbkt/ExpQueryResults/zorba/jsoniq/obj_constr_02.xml.res 2012-09-20 04:54:07 +0000
293+++ test/rbkt/ExpQueryResults/zorba/jsoniq/obj_constr_02.xml.res 2012-10-01 16:22:23 +0000
294@@ -1,1 +1,1 @@
295-{ "n1" : { "type" : "node()", "value" : "<node>10</node>" }, "n2" : { "type" : "node()", "value" : "<node>20</node>" } }
296+{ "n1" : { "type" : "element()", "value" : "<node>10</node>" }, "n2" : { "type" : "element()", "value" : "<node>20</node>" } }
297
298=== modified file 'test/rbkt/ExpQueryResults/zorba/jsoniq/obj_constr_04.xml.res'
299--- test/rbkt/ExpQueryResults/zorba/jsoniq/obj_constr_04.xml.res 2012-09-20 04:54:07 +0000
300+++ test/rbkt/ExpQueryResults/zorba/jsoniq/obj_constr_04.xml.res 2012-10-01 16:22:23 +0000
301@@ -1,1 +1,1 @@
302-{ "n1" : [ { "type" : "node()", "value" : "<node>10</node>" }, 1 ], "n2" : { "type" : "node()", "value" : "<node>20</node>" } }
303+{ "n1" : [ { "type" : "element()", "value" : "<node>10</node>" }, 1 ], "n2" : { "type" : "element()", "value" : "<node>20</node>" } }
304
305=== modified file 'test/rbkt/ExpQueryResults/zorba/jsoniq/roundtrip/encode_03.xml.res'
306--- test/rbkt/ExpQueryResults/zorba/jsoniq/roundtrip/encode_03.xml.res 2012-09-13 21:35:10 +0000
307+++ test/rbkt/ExpQueryResults/zorba/jsoniq/roundtrip/encode_03.xml.res 2012-10-01 16:22:23 +0000
308@@ -1,1 +1,1 @@
309-{ "serialized XML" : { "Q{http://jsoniq.org/roundtrip}type" : "node()", "Q{http://jsoniq.org/roundtrip}value" : "<para>\n A pair named \"[$prefix]value\" (where [$prefix] is replaced with the\n value of the parameter $prefix) and whose value is a serialization\n of the XML node according to the XML output method and with the\n serialization parameters specified by $param.\n </para>" } }
310\ No newline at end of file
311+{ "serialized XML" : { "Q{http://jsoniq.org/roundtrip}type" : "element()", "Q{http://jsoniq.org/roundtrip}value" : "<para>\n A pair named \"[$prefix]value\" (where [$prefix] is replaced with the\n value of the parameter $prefix) and whose value is a serialization\n of the XML node according to the XML output method and with the\n serialization parameters specified by $param.\n </para>" } }
312
313=== modified file 'test/rbkt/ExpQueryResults/zorba/jsoniq/roundtrip/encode_04.xml.res'
314--- test/rbkt/ExpQueryResults/zorba/jsoniq/roundtrip/encode_04.xml.res 2012-09-13 21:40:53 +0000
315+++ test/rbkt/ExpQueryResults/zorba/jsoniq/roundtrip/encode_04.xml.res 2012-10-01 16:22:23 +0000
316@@ -1,1 +1,1 @@
317-{ "serialized XML" : { "pre-type" : "node()", "pre-value" : "<a>\n <b>text<c>more text</c>\n </b>\n</a>" } }
318\ No newline at end of file
319+{ "serialized XML" : { "pre-type" : "element()", "pre-value" : "<a>\n <b>text<c>more text</c>\n </b>\n</a>" } }
320
321=== added file 'test/rbkt/ExpQueryResults/zorba/jsoniq/roundtrip/encode_10.xml.res'
322--- test/rbkt/ExpQueryResults/zorba/jsoniq/roundtrip/encode_10.xml.res 1970-01-01 00:00:00 +0000
323+++ test/rbkt/ExpQueryResults/zorba/jsoniq/roundtrip/encode_10.xml.res 2012-10-01 16:22:23 +0000
324@@ -0,0 +1,1 @@
325+{ "comment" : { "Q{http://jsoniq.org/roundtrip}type" : "comment()", "Q{http://jsoniq.org/roundtrip}value" : "<!--a comment-->" }, "document" : { "Q{http://jsoniq.org/roundtrip}type" : "document-node()", "Q{http://jsoniq.org/roundtrip}value" : "<a/>" }, "pi" : { "Q{http://jsoniq.org/roundtrip}type" : "processing-instruction()", "Q{http://jsoniq.org/roundtrip}value" : "<?target an instruction?>" }, "text" : { "Q{http://jsoniq.org/roundtrip}type" : "text()", "Q{http://jsoniq.org/roundtrip}value" : "some text" } }
326
327=== modified file 'test/rbkt/ExpQueryResults/zorba/jsoniq/roundtrip/roundtrip_03.xml.res'
328--- test/rbkt/ExpQueryResults/zorba/jsoniq/roundtrip/roundtrip_03.xml.res 2012-09-20 17:44:15 +0000
329+++ test/rbkt/ExpQueryResults/zorba/jsoniq/roundtrip/roundtrip_03.xml.res 2012-10-01 16:22:23 +0000
330@@ -1,1 +1,1 @@
331-{ "foo" : { "Q{http://jsoniq.org/roundtrip}type" : "node()", "Q{http://jsoniq.org/roundtrip}value" : "<a id=\"bar\"/>" } }
332+{ "foo" : { "Q{http://jsoniq.org/roundtrip}type" : "element()", "Q{http://jsoniq.org/roundtrip}value" : "<a id=\"bar\"/>" } }
333
334=== added file 'test/rbkt/ExpQueryResults/zorba/jsoniq/roundtrip/roundtrip_06.xml.res'
335--- test/rbkt/ExpQueryResults/zorba/jsoniq/roundtrip/roundtrip_06.xml.res 1970-01-01 00:00:00 +0000
336+++ test/rbkt/ExpQueryResults/zorba/jsoniq/roundtrip/roundtrip_06.xml.res 2012-10-01 16:22:23 +0000
337@@ -0,0 +1,2 @@
338+<?xml version="1.0" encoding="UTF-8"?>
339+true true true true
340
341=== added file 'test/rbkt/Queries/zorba/jsoniq/roundtrip/encode_10.xq'
342--- test/rbkt/Queries/zorba/jsoniq/roundtrip/encode_10.xq 1970-01-01 00:00:00 +0000
343+++ test/rbkt/Queries/zorba/jsoniq/roundtrip/encode_10.xq 2012-10-01 16:22:23 +0000
344@@ -0,0 +1,8 @@
345+jn:encode-for-roundtrip(
346+ {
347+ 'comment' : comment { "a comment" },
348+ 'document' : document { <a/> },
349+ 'pi' : processing-instruction target { "an instruction" },
350+ 'text' : text { "some text" }
351+ }
352+)
353
354=== added file 'test/rbkt/Queries/zorba/jsoniq/roundtrip/roundtrip_06.xq'
355--- test/rbkt/Queries/zorba/jsoniq/roundtrip/roundtrip_06.xq 1970-01-01 00:00:00 +0000
356+++ test/rbkt/Queries/zorba/jsoniq/roundtrip/roundtrip_06.xq 2012-10-01 16:22:23 +0000
357@@ -0,0 +1,15 @@
358+let $enc := jn:encode-for-roundtrip(
359+ {
360+ 'comment' : comment { "a comment" },
361+ 'document' : document { <a/> } ,
362+ 'pi' : processing-instruction target { "an instruction" },
363+ 'text' : text { "some text" }
364+ }
365+ )
366+let $dec := jn:decode-from-roundtrip($enc)
367+return (
368+ $dec("comment") instance of comment(),
369+ $dec("document") instance of document-node(),
370+ $dec("pi") instance of processing-instruction(),
371+ $dec("text") instance of text()
372+)

Subscribers

People subscribed via source and target branches