Merge lp:~zorba-coders/zorba/xquery3.0_funcs into lp:zorba

Proposed by Matthias Brantner
Status: Superseded
Proposed branch: lp:~zorba-coders/zorba/xquery3.0_funcs
Merge into: lp:zorba
Diff against target: 1366 lines (+644/-223)
27 files modified
ChangeLog (+13/-15)
modules/w3c/xpath_functions.xq (+17/-1)
src/compiler/translator/translator.cpp (+4/-0)
src/functions/pregenerated/func_accessors.cpp (+20/-0)
src/functions/pregenerated/func_accessors.h (+17/-1)
src/functions/pregenerated/func_nodes.cpp (+44/-0)
src/functions/pregenerated/func_nodes.h (+15/-0)
src/functions/pregenerated/func_parse_fragment.cpp (+1/-1)
src/functions/pregenerated/function_enum.h (+4/-0)
src/runtime/accessors/accessors_impl.cpp (+1/-2)
src/runtime/collections/collections_impl.cpp (+116/-116)
src/runtime/collections/pregenerated/collections.h (+3/-3)
src/runtime/nodes/nodes_impl.cpp (+117/-0)
src/runtime/nodes/pregenerated/nodes.cpp (+22/-0)
src/runtime/nodes/pregenerated/nodes.h (+34/-0)
src/runtime/parsing_and_serializing/parse_fragment_impl.cpp (+65/-13)
src/runtime/parsing_and_serializing/parsing_and_serializing_impl.cpp (+0/-1)
src/runtime/parsing_and_serializing/pregenerated/parse_fragment.cpp (+15/-15)
src/runtime/parsing_and_serializing/pregenerated/parse_fragment.h (+11/-11)
src/runtime/spec/accessors/accessors.xml (+5/-2)
src/runtime/spec/collections/collections.xml (+26/-26)
src/runtime/spec/nodes/nodes.xml (+27/-0)
src/runtime/spec/parsing_and_serializing/parse_fragment.xml (+32/-3)
src/runtime/spec/parsing_and_serializing/parsing_and_serializing.xml (+3/-3)
src/runtime/visitors/pregenerated/planiter_visitor.h (+8/-3)
src/runtime/visitors/pregenerated/printer_visitor.cpp (+19/-5)
src/runtime/visitors/pregenerated/printer_visitor.h (+5/-2)
To merge this branch: bzr merge lp:~zorba-coders/zorba/xquery3.0_funcs
Reviewer Review Type Date Requested Status
Matthias Brantner Pending
Review via email: mp+104336@code.launchpad.net

This proposal supersedes a proposal from 2012-05-02.

This proposal has been superseded by a proposal from 2012-05-02.

Commit message

Added XQuery 3.0 Functions
path, has-children#0, nilled#0

Description of the change

Added XQuery 3.0 Functions
path, has-children#0, nilled#0

To post a comment you must log in.
Revision history for this message
Matthias Brantner (matthias-brantner) wrote : Posted in a previous version of this proposal

- The fn:path functions returns a wrong result for the following doc/query:

doc.xml
<a><b/><b/></a>

fn:path(doc("doc.xml")/a/b[2])
/"":a[2]/"":b[1]

- As far as I understood from the spec, fn:parse-xml-fragment should return true for the query

fn:parse-xml-fragment("<alpha>abcd</alpha><beta>abcd</beta>") instance of document-node()

review: Needs Fixing
Revision history for this message
Juan Zacarias (juan457) wrote : Posted in a previous version of this proposal

> - The fn:path functions returns a wrong result for the following doc/query:
>
> doc.xml
> <a><b/><b/></a>
>
> fn:path(doc("doc.xml")/a/b[2])
> /"":a[2]/"":b[1]
Oh It seems I used the wrong value for the position. I have a question about this I was using Item->getRefCount() for the value of the position of the node, but it appears to be wrong is that info on the node stored anywhere else? if not should I implement it as info inside the Item? or just for the function?

>
> - As far as I understood from the spec, fn:parse-xml-fragment should return
> true for the query
>
> fn:parse-xml-fragment("<alpha>abcd</alpha><beta>abcd</beta>") instance of
> document-node()
I will take a look on this

Revision history for this message
Matthias Brantner (matthias-brantner) wrote : Posted in a previous version of this proposal

> > - The fn:path functions returns a wrong result for the following doc/query:
> >
> > doc.xml
> > <a><b/><b/></a>
> >
> > fn:path(doc("doc.xml")/a/b[2])
> > /"":a[2]/"":b[1]
> Oh It seems I used the wrong value for the position. I have a question about
> this I was using Item->getRefCount() for the value of the position of the
> node, but it appears to be wrong is that info on the node stored anywhere
> else? if not should I implement it as info inside the Item? or just for the
> function?
getRefCount() returns the number of references to the node. It cannot be used as the position among siblings. I'm afraid there is no such information stored in a node. You probably have to count the number of preceding siblings, i.e. go to the parent and iterate over the children until you reached the node in question.

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal

There are additional revisions which have not been approved in review. Please seek review and approval of these new revisions.

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal

The attempt to merge lp:~zorba-coders/zorba/xquery3.0_funcs 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 xquery3.0_funcs-2012-05-02T06-49-10.108Z is finished.
  The final status was:

  No tests were run - build or configure step must have failed.

  Not commiting changes.

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

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal

The attempt to merge lp:~zorba-coders/zorba/xquery3.0_funcs 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 xquery3.0_funcs-2012-05-02T06-57-56.708Z is finished.
  The final status was:

  No tests were run - build or configure step must have failed.

  Not commiting changes.

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/xquery3.0_funcs 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 xquery3.0_funcs-2012-05-02T07-18-08.166Z is finished.
  The final status was:

  No tests were run - build or configure step must have failed.

  Not commiting changes.

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

10744. By Matthias Brantner

commit of more pregenerated files

10745. By Matthias Brantner

fixed failing tests

10747. By Nicolae Brinza

Enabled fn:parse-xml-fragment() which now correctly retuns only one document node holding all the fragments

10748. By Nicolae Brinza

Fixed a new bug in the parse-fragment code reported by Juan. Added relevant testcases

10749. By Nicolae Brinza

Merged with Zorba trunk.

10750. By Nicolae Brinza

Fixed a reported bug in the parse-fragment code.

10751. By Nicolae Brinza

Merged with Zorba trunk

10752. By Juan Zacarias

Fixed failing tests

10753. By Nicolae Brinza

Fixed the parse-fragment() bug where an empty string input would not return a document node.

10754. By Juan Zacarias

updated changelog

10755. By Nicolae Brinza

Merged with Zorba trunk

10756. By Nicolae Brinza

Fixed the Changelog note for the fn:parse-xml-fragment#1 implementation

10757. By Nicolae Brinza

Merged with Zorba trunk

10758. By Nicolae Brinza

Fixed the fn:parse-xml-fragment() pregenerated files so that Zorba now correctly builds

10759. By Nicolae Brinza

Fixed the backwards-compatible zorba:parse-xml-fragment() function so that it works with the 'w' option enabled

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ChangeLog'
2--- ChangeLog 2012-05-01 15:54:27 +0000
3+++ ChangeLog 2012-05-02 07:34:19 +0000
4@@ -3,11 +3,15 @@
5 version 2.5
6
7 New Features:
8- * fn:available-environment-variables
9- * fn:environment-variables
10- * fn:uri-collection
11- * fn:unparsed-text
12- * fn:unparsed-text-available
13+ * XQuery 3.0 functions
14+ - fn:available-environment-variables
15+ - fn:environment-variables
16+ - fn:uri-collection
17+ - fn:unparsed-text
18+ - fn:unparsed-text-available
19+ - fn:has-children#0
20+ - fn:nilled#0
21+ - fn:path
22 * Extended API for Python, Java, PHP and Ruby.
23 * Add jvm classpath to zorbacmd and to Zorba API. Tracked by #931816
24 * Added full-text module.
25@@ -15,14 +19,11 @@
26 * Added XQJ support.
27 * Added CollectionManager and DocumentManager support for XQJ.
28
29-Optimization:
30-
31 Bug Fixes/Other Changes:
32 * Fixed bugs #931501 and #866987 (improved error messages for fn:format-number(). Additionally, the function now throws the FODF1310 error instead of XTDE1310, as the 3.0 spec requires)
33 * Fixed bug 955170 (Catch clause with URILiteral-based wilcard NameTest)
34 * Fixed bug 955135 (err:XQDY0044 not caught by try-catch expressions)
35- * Fixed bug #986075 (encountering flwor expr with no clauses; due to common
36- subexression being formed when inlining var in if-then-else expression)
37+ * Fixed bug #986075 (encountering flwor expr with no clauses; due to common subexression being formed when inlining var in if-then-else expression)
38 * Fixed bug #967864 (var substitution did not update theFreeVars property)
39 * Fixed bug #891650 (context size var not always declared within path expr)
40 * Fixed bug #948879 (--uri-path doesn't work with fetch:content())
41@@ -36,17 +37,14 @@
42 * Fixed bug #988412 (date:current-dateTime daylight saving)
43 * Fixed bug #912586, #912593 and #912722 (assertion failures with lax validation)
44 * Fixed bug #921458 (file:read-text-lines() blocking)
45- * Fixed bug #981405 (do not hoist expr containing try-catch variables out of the
46- associated try-catch expression)
47- * Fixed bug #947627 (throw XQST0099 if more than one declarations of context item
48- type in same module)
49+ * Fixed bug #981405 (do not hoist expr containing try-catch variables out of the associated try-catch expression)
50+ * Fixed bug #947627 (throw XQST0099 if more than one declarations of context item type in same module)
51 * Fixed bug #980526 (no-copy rule bug due to global var being set in "distant" udf)
52 * Fixed bug #949910 (has-children may be invoked on all nodes). Internally, zorba::store::Item::getChildren() now returns NULL on node classes without offspring (instead of raising an error).
53- * Fixed Bug #933490: Error ItemFactoryImpl::createBase64Binary with istream
54+ * Fixed Bug #933490 (Error ItemFactoryImpl::createBase64Binary with istream)
55 * Fixed bug #867112 (Diagnostic Handler was not working on external APIs)
56 * Fixed bug #857842 (Assertion failed with simple content element with comments)
57
58-
59 version 2.2
60
61 New Features:
62
63=== modified file 'modules/w3c/xpath_functions.xq'
64--- modules/w3c/xpath_functions.xq 2012-04-24 12:39:38 +0000
65+++ modules/w3c/xpath_functions.xq 2012-05-02 07:34:19 +0000
66@@ -522,6 +522,12 @@
67 declare function fn:parse-xml( $arg as xs:string?, $baseURI as xs:string) as document-node(element(*, xs:untyped)) external;
68
69 (:~
70+ : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-parse-xml-fragment">fn:parse-xml-fragment</a>
71+ :)
72+declare function fn:parse-xml-fragment( $arg as xs:string?) as document-node(element(*, xs:untyped)) external;
73+
74+
75+(:~
76 : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-prefix-from-QName">fn:prefix-from-QName</a>
77 :)
78 declare function fn:prefix-from-QName($arg as xs:QName?) as xs:NCName? external;
79@@ -864,6 +870,11 @@
80 (:~
81 : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-has-children">fn:has-children</a>
82 :)
83+declare function fn:has-children() as xs:boolean external;
84+
85+(:~
86+ : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-has-children">fn:has-children</a>
87+ :)
88 declare function fn:has-children($node as node()?) as xs:boolean external;
89
90 (:~
91@@ -923,12 +934,17 @@
92
93 (:~
94 : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-namespace-uri">fn:namespace-uri</a>
95- :)
96+ :)
97 declare function fn:namespace-uri($arg as node()?) as xs:anyURI external;
98
99 (:~
100 : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-nilled">fn:nilled</a>
101 :)
102+declare function fn:nilled() as xs:boolean external;
103+
104+(:~
105+ : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-nilled">fn:nilled</a>
106+ :)
107 declare function fn:nilled($arg as node()?) as xs:boolean? external;
108
109 (:~
110
111=== modified file 'src/compiler/translator/translator.cpp'
112--- src/compiler/translator/translator.cpp 2012-05-01 21:21:04 +0000
113+++ src/compiler/translator/translator.cpp 2012-05-02 07:34:19 +0000
114@@ -694,6 +694,10 @@
115 xquery_fns_def_dot.set(FunctionConsts::FN_DATA_0);
116 xquery_fns_def_dot.set(FunctionConsts::FN_DOCUMENT_URI_0);
117 xquery_fns_def_dot.set(FunctionConsts::FN_NODE_NAME_0);
118+ xquery_fns_def_dot.set(FunctionConsts::FN_NILLED_0);
119+ xquery_fns_def_dot.set(FunctionConsts::FN_HAS_CHILDREN_0);
120+ xquery_fns_def_dot.set(FunctionConsts::FN_PATH_0);
121+
122
123 op_concatenate = GET_BUILTIN_FUNCTION(OP_CONCATENATE_N);
124 assert(op_concatenate != NULL);
125
126=== modified file 'src/functions/pregenerated/func_accessors.cpp'
127--- src/functions/pregenerated/func_accessors.cpp 2012-04-24 12:39:38 +0000
128+++ src/functions/pregenerated/func_accessors.cpp 2012-05-02 07:34:19 +0000
129@@ -50,6 +50,15 @@
130 return new NodeNameIterator(sctx, loc, argv);
131 }
132
133+PlanIter_t fn_nilled_3_0::codegen(
134+ CompilerCB*,
135+ static_context* sctx,
136+ const QueryLoc& loc,
137+ std::vector<PlanIter_t>& argv,
138+ expr& ann) const
139+{
140+ return new NilledIterator(sctx, loc, argv);
141+}
142 PlanIter_t fn_nilled::codegen(
143 CompilerCB*,
144 static_context* sctx,
145@@ -138,6 +147,17 @@
146 {
147
148
149+ DECL_WITH_KIND(sctx, fn_nilled_3_0,
150+ (createQName("http://www.w3.org/2005/xpath-functions","","nilled"),
151+ GENV_TYPESYSTEM.BOOLEAN_TYPE_ONE),
152+ FunctionConsts::FN_NILLED_0);
153+
154+ }
155+
156+
157+ {
158+
159+
160 DECL_WITH_KIND(sctx, fn_nilled,
161 (createQName("http://www.w3.org/2005/xpath-functions","","nilled"),
162 GENV_TYPESYSTEM.ANY_NODE_TYPE_QUESTION,
163
164=== modified file 'src/functions/pregenerated/func_accessors.h'
165--- src/functions/pregenerated/func_accessors.h 2012-04-24 12:39:38 +0000
166+++ src/functions/pregenerated/func_accessors.h 2012-05-02 07:34:19 +0000
167@@ -72,6 +72,22 @@
168
169
170 //fn:nilled
171+class fn_nilled_3_0 : public function
172+{
173+public:
174+ fn_nilled_3_0(const signature& sig, FunctionConsts::FunctionKind kind)
175+ :
176+ function(sig, kind)
177+ {
178+theXQueryVersion = StaticContextConsts::xquery_version_3_0;
179+ }
180+
181+ bool mustCopyInputNodes(expr* fo, csize producer) const { return true; }
182+
183+ CODEGEN_DECL();
184+};
185+
186+//fn:nilled
187 class fn_nilled : public function
188 {
189 public:
190@@ -82,7 +98,7 @@
191
192 }
193
194- bool mustCopyInputNodes(expr* fo, csize producer) const { return false; }
195+ bool mustCopyInputNodes(expr* fo, csize producer) const { return true; }
196
197 CODEGEN_DECL();
198 };
199
200=== modified file 'src/functions/pregenerated/func_nodes.cpp'
201--- src/functions/pregenerated/func_nodes.cpp 2012-04-24 12:39:38 +0000
202+++ src/functions/pregenerated/func_nodes.cpp 2012-05-02 07:34:19 +0000
203@@ -231,6 +231,16 @@
204 return new LeastCommonAncestor(sctx, loc, argv);
205 }
206
207+PlanIter_t fn_path_3_0::codegen(
208+ CompilerCB*,
209+ static_context* sctx,
210+ const QueryLoc& loc,
211+ std::vector<PlanIter_t>& argv,
212+ expr& ann) const
213+{
214+ return new FnPathIterator(sctx, loc, argv);
215+}
216+
217 void populate_context_nodes(static_context* sctx)
218 {
219 {
220@@ -356,6 +366,17 @@
221
222 DECL_WITH_KIND(sctx, fn_has_children_3_0,
223 (createQName("http://www.w3.org/2005/xpath-functions","","has-children"),
224+ GENV_TYPESYSTEM.BOOLEAN_TYPE_ONE),
225+ FunctionConsts::FN_HAS_CHILDREN_0);
226+
227+ }
228+
229+
230+ {
231+
232+
233+ DECL_WITH_KIND(sctx, fn_has_children_3_0,
234+ (createQName("http://www.w3.org/2005/xpath-functions","","has-children"),
235 GENV_TYPESYSTEM.ANY_NODE_TYPE_QUESTION,
236 GENV_TYPESYSTEM.BOOLEAN_TYPE_ONE),
237 FunctionConsts::FN_HAS_CHILDREN_1);
238@@ -538,6 +559,29 @@
239
240 }
241
242+
243+ {
244+
245+
246+ DECL_WITH_KIND(sctx, fn_path_3_0,
247+ (createQName("http://www.w3.org/2005/xpath-functions","","path"),
248+ GENV_TYPESYSTEM.STRING_TYPE_QUESTION),
249+ FunctionConsts::FN_PATH_0);
250+
251+ }
252+
253+
254+ {
255+
256+
257+ DECL_WITH_KIND(sctx, fn_path_3_0,
258+ (createQName("http://www.w3.org/2005/xpath-functions","","path"),
259+ GENV_TYPESYSTEM.ANY_NODE_TYPE_QUESTION,
260+ GENV_TYPESYSTEM.STRING_TYPE_QUESTION),
261+ FunctionConsts::FN_PATH_1);
262+
263+ }
264+
265 }
266
267
268
269=== modified file 'src/functions/pregenerated/func_nodes.h'
270--- src/functions/pregenerated/func_nodes.h 2012-04-24 12:39:38 +0000
271+++ src/functions/pregenerated/func_nodes.h 2012-05-02 07:34:19 +0000
272@@ -372,6 +372,21 @@
273 };
274
275
276+//fn:path
277+class fn_path_3_0 : public function
278+{
279+public:
280+ fn_path_3_0(const signature& sig, FunctionConsts::FunctionKind kind)
281+ :
282+ function(sig, kind)
283+ {
284+theXQueryVersion = StaticContextConsts::xquery_version_3_0;
285+ }
286+
287+ CODEGEN_DECL();
288+};
289+
290+
291 } //namespace zorba
292
293
294
295=== modified file 'src/functions/pregenerated/func_parse_fragment.cpp'
296--- src/functions/pregenerated/func_parse_fragment.cpp 2012-04-24 12:39:38 +0000
297+++ src/functions/pregenerated/func_parse_fragment.cpp 2012-05-02 07:34:19 +0000
298@@ -38,7 +38,7 @@
299 std::vector<PlanIter_t>& argv,
300 expr& ann) const
301 {
302- return new FnParseXmlFragmentIterator(sctx, loc, argv);
303+ return new FnZorbaParseXmlFragmentIterator(sctx, loc, argv);
304 }
305
306 void populate_context_parse_fragment(static_context* sctx)
307
308=== modified file 'src/functions/pregenerated/function_enum.h'
309--- src/functions/pregenerated/function_enum.h 2012-04-26 13:25:13 +0000
310+++ src/functions/pregenerated/function_enum.h 2012-05-02 07:34:19 +0000
311@@ -22,6 +22,7 @@
312 // ******************************************
313 FN_NODE_NAME_0,
314 FN_NODE_NAME_1,
315+ FN_NILLED_0,
316 FN_NILLED_1,
317 FN_STRING_0,
318 FN_STRING_1,
319@@ -251,6 +252,7 @@
320 FN_LANG_2,
321 FN_NUMBER_0,
322 FN_NUMBER_1,
323+ FN_HAS_CHILDREN_0,
324 FN_HAS_CHILDREN_1,
325 FN_INNERMOST_1,
326 FN_OUTERMOST_1,
327@@ -266,6 +268,8 @@
328 FN_ZORBA_NODE_PRECEDING_SIBLING_OF_2,
329 FN_ZORBA_NODE_LEVEL_1,
330 FN_ZORBA_NODE_LEAST_COMMON_ANCESTOR_2,
331+ FN_PATH_0,
332+ FN_PATH_1,
333 FN_ABS_1,
334 FN_CEILING_1,
335 FN_FLOOR_1,
336
337=== modified file 'src/runtime/accessors/accessors_impl.cpp'
338--- src/runtime/accessors/accessors_impl.cpp 2012-04-24 12:39:38 +0000
339+++ src/runtime/accessors/accessors_impl.cpp 2012-05-02 07:34:19 +0000
340@@ -79,8 +79,7 @@
341 if (consumeNext(inNode, theChildren[0].getp(), planState))
342 {
343 if (inNode->isNode()) {
344- result = inNode->getNilled();
345- STACK_PUSH(result != NULL, state);
346+ STACK_PUSH(GENV_ITEMFACTORY->createBoolean(result, inNode->getNilled() != NULL), state);
347 } else
348 throw XQUERY_EXCEPTION(
349 err::XPTY0004,
350
351=== modified file 'src/runtime/collections/collections_impl.cpp'
352--- src/runtime/collections/collections_impl.cpp 2012-04-24 12:39:38 +0000
353+++ src/runtime/collections/collections_impl.cpp 2012-05-02 07:34:19 +0000
354@@ -2504,122 +2504,122 @@
355 /*******************************************************************************
356 14.8.5 fn:uri-collection
357 ********************************************************************************/
358- FnURICollectionIteratorState::~FnURICollectionIteratorState()
359- {
360- if(theIterator != NULL)
361- {
362- if(theIteratorOpened)
363- {
364- theIterator->close();
365- theIteratorOpened = false;
366- }
367- theIterator = NULL;
368- }
369- }
370-
371- void FnURICollectionIteratorState::init(PlanState& planState)
372- {
373- PlanIteratorState::init(planState);
374- theIterator = NULL;
375- }
376-
377- void FnURICollectionIteratorState::reset(PlanState& planState)
378- {
379- PlanIteratorState::reset(planState);
380-
381- if(theIterator != NULL)
382- {
383- if(theIteratorOpened)
384- {
385- theIterator->close();
386- theIteratorOpened = false;
387- }
388- theIterator = NULL;
389- }
390- }
391-
392- bool FnURICollectionIterator::nextImpl(store::Item_t& result, PlanState& planState) const
393- {
394- store::Item_t lURI, resolvedURIItem, lIte;
395- store::Collection_t coll;
396- std::auto_ptr<internal::Resource> lResource;
397- internal::CollectionResource* lCollResource;
398- zstring resolvedURIString;
399- zstring lErrorMessage;
400- zstring docuri;
401-
402- FnURICollectionIteratorState* state;
403- DEFAULT_STACK_INIT(FnURICollectionIteratorState, state, planState);
404-
405- if(theChildren.size() == 1 &&
406- consumeNext(lURI, theChildren[0].getp(),planState))
407- {
408- try
409- {
410- resolvedURIString= theSctx->resolve_relative_uri(lURI->getStringValue());
411- }
412- catch (ZorbaException const&)
413- {
414- throw XQUERY_EXCEPTION(
415- err::FODC0004,
416- ERROR_PARAMS(lURI->getStringValue(), ZED( BadAnyURI ) ),
417- ERROR_LOC( loc )
418- );
419- }
420- }
421- else
422- {
423- resolvedURIItem = planState.theGlobalDynCtx->get_default_collection();
424-
425- if ( NULL == resolvedURIItem )
426- throw XQUERY_EXCEPTION(
427- err::FODC0002,
428- ERROR_PARAMS( ZED( DefaultCollection), ZED( NotDefInDynamicCtx ) ),
429- ERROR_LOC( loc )
430- );
431-
432- resolvedURIString = theSctx->resolve_relative_uri(resolvedURIItem->getStringValue());
433- }
434-
435- lResource = theSctx->resolve_uri(resolvedURIString,
436- internal::EntityData::COLLECTION,
437- lErrorMessage);
438-
439- lCollResource = dynamic_cast<internal::CollectionResource*>(lResource.get());
440-
441- if( lCollResource == 0 || !(coll = lCollResource->getCollection()) )
442- {
443- throw XQUERY_EXCEPTION(
444- err::FODC0002,
445- ERROR_PARAMS( resolvedURIString, lErrorMessage ),
446- ERROR_LOC( loc )
447- );
448- }
449-
450- // return collection nodes
451- state->theIterator = coll->getIterator();
452- ZORBA_ASSERT(state->theIterator != NULL);
453- state->theIterator->open();
454- state->theIteratorOpened = true;
455-
456- //return the DocumentURI of the Collection
457- while(state->theIterator->next(lIte))
458- {
459- lIte->getDocumentURI(docuri);
460- if(!docuri.empty())
461- {
462- STACK_PUSH(GENV_ITEMFACTORY->createAnyURI(result, docuri), state);
463- }
464- }
465-
466- //close iterator
467- state->theIterator->close();
468- state->theIteratorOpened = false;
469-
470- STACK_PUSH(false, state);
471- STACK_END(state);
472-
473- }
474+FnURICollectionIteratorState::~FnURICollectionIteratorState()
475+{
476+ if(theIterator != NULL)
477+ {
478+ if(theIteratorOpened)
479+ {
480+ theIterator->close();
481+ theIteratorOpened = false;
482+ }
483+ theIterator = NULL;
484+ }
485+}
486+
487+void FnURICollectionIteratorState::init(PlanState& planState)
488+{
489+ PlanIteratorState::init(planState);
490+ theIterator = NULL;
491+}
492+
493+void FnURICollectionIteratorState::reset(PlanState& planState)
494+{
495+ PlanIteratorState::reset(planState);
496+
497+ if(theIterator != NULL)
498+ {
499+ if(theIteratorOpened)
500+ {
501+ theIterator->close();
502+ theIteratorOpened = false;
503+ }
504+ theIterator = NULL;
505+ }
506+}
507+
508+bool FnURICollectionIterator::nextImpl(store::Item_t& result, PlanState& planState) const
509+{
510+ store::Item_t lURI, resolvedURIItem, lIte;
511+ store::Collection_t coll;
512+ std::auto_ptr<internal::Resource> lResource;
513+ internal::CollectionResource* lCollResource;
514+ zstring resolvedURIString;
515+ zstring lErrorMessage;
516+ zstring docuri;
517+
518+ FnURICollectionIteratorState* state;
519+ DEFAULT_STACK_INIT(FnURICollectionIteratorState, state, planState);
520+
521+ if(theChildren.size() == 1 &&
522+ consumeNext(lURI, theChildren[0].getp(),planState))
523+ {
524+ try
525+ {
526+ resolvedURIString= theSctx->resolve_relative_uri(lURI->getStringValue());
527+ }
528+ catch (ZorbaException const&)
529+ {
530+ throw XQUERY_EXCEPTION(
531+ err::FODC0004,
532+ ERROR_PARAMS(lURI->getStringValue(), ZED( BadAnyURI ) ),
533+ ERROR_LOC( loc )
534+ );
535+ }
536+ }
537+ else
538+ {
539+ resolvedURIItem = planState.theGlobalDynCtx->get_default_collection();
540+
541+ if ( NULL == resolvedURIItem )
542+ throw XQUERY_EXCEPTION(
543+ err::FODC0002,
544+ ERROR_PARAMS( ZED( DefaultCollection), ZED( NotDefInDynamicCtx ) ),
545+ ERROR_LOC( loc )
546+ );
547+
548+ resolvedURIString = theSctx->resolve_relative_uri(resolvedURIItem->getStringValue());
549+ }
550+
551+ lResource = theSctx->resolve_uri(resolvedURIString,
552+ internal::EntityData::COLLECTION,
553+ lErrorMessage);
554+
555+ lCollResource = dynamic_cast<internal::CollectionResource*>(lResource.get());
556+
557+ if( lCollResource == 0 || !(coll = lCollResource->getCollection()) )
558+ {
559+ throw XQUERY_EXCEPTION(
560+ err::FODC0002,
561+ ERROR_PARAMS( resolvedURIString, lErrorMessage ),
562+ ERROR_LOC( loc )
563+ );
564+ }
565+
566+ // return collection nodes
567+ state->theIterator = coll->getIterator();
568+ ZORBA_ASSERT(state->theIterator != NULL);
569+ state->theIterator->open();
570+ state->theIteratorOpened = true;
571+
572+ //return the DocumentURI of the Collection
573+ while(state->theIterator->next(lIte))
574+ {
575+ lIte->getDocumentURI(docuri);
576+ if(!docuri.empty())
577+ {
578+ STACK_PUSH(GENV_ITEMFACTORY->createAnyURI(result, docuri), state);
579+ }
580+ }
581+
582+ //close iterator
583+ state->theIterator->close();
584+ state->theIteratorOpened = false;
585+
586+ STACK_PUSH(false, state);
587+ STACK_END(state);
588+
589+}
590
591
592 } // namespace zorba
593
594=== modified file 'src/runtime/collections/pregenerated/collections.h'
595--- src/runtime/collections/pregenerated/collections.h 2012-04-24 12:39:38 +0000
596+++ src/runtime/collections/pregenerated/collections.h 2012-05-02 07:34:19 +0000
597@@ -1469,9 +1469,9 @@
598
599 /**
600 *
601- * Returns a sequence of xs:anyURI values representing the document URIs of the
602- * documents in a collection.
603- *
604+ * Returns a sequence of xs:anyURI values representing the document URIs of the
605+ * documents in a collection.
606+ *
607 * Author: Zorba Team
608 */
609 class FnURICollectionIteratorState : public PlanIteratorState
610
611=== modified file 'src/runtime/nodes/nodes_impl.cpp'
612--- src/runtime/nodes/nodes_impl.cpp 2012-04-24 12:39:38 +0000
613+++ src/runtime/nodes/nodes_impl.cpp 2012-05-02 07:34:19 +0000
614@@ -628,5 +628,122 @@
615 STACK_END (state);
616 }
617
618+/*******************************************************************************
619+********************************************************************************/
620+int getNodePosition(store::Item_t aNode)
621+{
622+ int count = 1;
623+ store::Iterator_t lIterator = aNode->getParent()->getChildren();
624+ store::Item_t lItem;
625+ lIterator->open();
626+ while(lIterator->next(lItem))
627+ {
628+ if(lItem->getNodeKind() == aNode->getNodeKind())
629+ if(lItem->equals(aNode))
630+ break;
631+ else
632+ count++;
633+ }
634+ lIterator->close();
635+ return count;
636+}
637+
638+bool FnPathIterator::nextImpl(store::Item_t& result, PlanState& planState) const
639+{
640+ store::Item_t inNode;
641+ store::Item_t nodeName;
642+ store::NsBindings nsBindings;
643+ zstring path;
644+ zstring temp;
645+ zstring zNamespace;
646+ zstring zLocalName;
647+ zstring zPosition;
648+ bool rootIsDocument = false;
649+
650+ PlanIteratorState* state;
651+ DEFAULT_STACK_INIT(PlanIteratorState, state, planState);
652+
653+ if (consumeNext(inNode, theChildren[0], planState));
654+ {
655+ do
656+ {
657+ switch (inNode->getNodeKind())
658+ {
659+ case store::StoreConsts::documentNode:
660+ temp = path;
661+ path = "/";
662+ path += temp;
663+ rootIsDocument = true;
664+ break;
665+ case store::StoreConsts::elementNode:
666+ nodeName = inNode->getNodeName();
667+ zNamespace = nodeName->getNamespace();
668+ zLocalName = nodeName->getLocalName();
669+ zPosition = ztd::to_string(getNodePosition(inNode));
670+ temp = path;
671+ path = "\""+zNamespace+"\":"+zLocalName+"["+zPosition.c_str()+"]";
672+ path += temp;
673+ break;
674+ case store::StoreConsts::attributeNode:
675+ nodeName = inNode->getNodeName();
676+ zNamespace =nodeName->getNamespace();
677+ zLocalName = nodeName->getLocalName();
678+ if(zNamespace != "")
679+ {
680+ temp = path;
681+ path = "@\""+zNamespace+"\":"+zLocalName;
682+ path += temp;
683+ }
684+ else
685+ {
686+ temp = path;
687+ path = "@"+zLocalName;
688+ path += temp;
689+ }
690+ break;
691+ case store::StoreConsts::textNode:
692+ zPosition = ztd::to_string(getNodePosition(inNode));
693+ temp = path;
694+ path = "text()["+zPosition+"]";
695+ path += temp;
696+ break;
697+ case store::StoreConsts::commentNode:
698+ zPosition = ztd::to_string(getNodePosition(inNode));
699+ temp = path;
700+ path = "comment()["+zPosition+"]";
701+ path += temp;
702+ break;
703+ default:
704+ if(inNode->isProcessingInstruction())
705+ {
706+ nodeName = inNode->getNodeName();
707+ zLocalName = nodeName->getLocalName();
708+ zPosition = ztd::to_string(getNodePosition(inNode));
709+ temp = path;
710+ path = "processing-instruction("+zLocalName+")["+zPosition+"]";
711+ path += temp;
712+ }
713+ break;
714+ }
715+ inNode = inNode->getParent();
716+
717+ if(inNode && inNode->getNodeKind() != store::StoreConsts::documentNode)
718+ {
719+ temp = path;
720+ path = "/";
721+ path += temp;
722+ }
723+
724+ } while (inNode);
725+
726+ if(rootIsDocument)
727+ STACK_PUSH(GENV_ITEMFACTORY->createString(result, path), state);
728+ else
729+ throw XQUERY_EXCEPTION(err::FODC0001, ERROR_PARAMS("fn:path"), ERROR_LOC(loc));
730+ }
731+
732+ STACK_END (state);
733+}
734+
735 } // namespace zorba
736 /* vim:set et sw=2 ts=2: */
737
738=== modified file 'src/runtime/nodes/pregenerated/nodes.cpp'
739--- src/runtime/nodes/pregenerated/nodes.cpp 2012-04-24 12:39:38 +0000
740+++ src/runtime/nodes/pregenerated/nodes.cpp 2012-05-02 07:34:19 +0000
741@@ -474,6 +474,28 @@
742 // </LeastCommonAncestor>
743
744
745+// <FnPathIterator>
746+FnPathIterator::class_factory<FnPathIterator>
747+FnPathIterator::g_class_factory;
748+
749+
750+void FnPathIterator::accept(PlanIterVisitor& v) const {
751+ v.beginVisit(*this);
752+
753+ std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin();
754+ std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end();
755+ for ( ; lIter != lEnd; ++lIter ){
756+ (*lIter)->accept(v);
757+ }
758+
759+ v.endVisit(*this);
760+}
761+
762+FnPathIterator::~FnPathIterator() {}
763+
764+// </FnPathIterator>
765+
766+
767
768 }
769
770
771=== modified file 'src/runtime/nodes/pregenerated/nodes.h'
772--- src/runtime/nodes/pregenerated/nodes.h 2012-04-24 12:39:38 +0000
773+++ src/runtime/nodes/pregenerated/nodes.h 2012-05-02 07:34:19 +0000
774@@ -720,6 +720,40 @@
775 };
776
777
778+/**
779+ *
780+ * Author: Zorba Team
781+ */
782+class FnPathIterator : public NaryBaseIterator<FnPathIterator, PlanIteratorState>
783+{
784+public:
785+ SERIALIZABLE_CLASS(FnPathIterator);
786+
787+ SERIALIZABLE_CLASS_CONSTRUCTOR2T(FnPathIterator,
788+ NaryBaseIterator<FnPathIterator, PlanIteratorState>);
789+
790+ void serialize( ::zorba::serialization::Archiver& ar)
791+ {
792+ serialize_baseclass(ar,
793+ (NaryBaseIterator<FnPathIterator, PlanIteratorState>*)this);
794+ }
795+
796+ FnPathIterator(
797+ static_context* sctx,
798+ const QueryLoc& loc,
799+ std::vector<PlanIter_t>& children)
800+ :
801+ NaryBaseIterator<FnPathIterator, PlanIteratorState>(sctx, loc, children)
802+ {}
803+
804+ virtual ~FnPathIterator();
805+
806+ void accept(PlanIterVisitor& v) const;
807+
808+ bool nextImpl(store::Item_t& result, PlanState& aPlanState) const;
809+};
810+
811+
812 }
813 #endif
814 /*
815
816=== modified file 'src/runtime/parsing_and_serializing/parse_fragment_impl.cpp'
817--- src/runtime/parsing_and_serializing/parse_fragment_impl.cpp 2012-04-24 12:39:38 +0000
818+++ src/runtime/parsing_and_serializing/parse_fragment_impl.cpp 2012-05-02 07:34:19 +0000
819@@ -170,11 +170,7 @@
820 }
821 }
822
823-/*******************************************************************************
824-
825-********************************************************************************/
826-
827-void FnParseXmlFragmentIteratorState::reset(PlanState& planState)
828+void FnZorbaParseXmlFragmentIteratorState::reset(PlanState& planState)
829 {
830 PlanIteratorState::reset(planState);
831 theFragmentStream.reset();
832@@ -184,20 +180,15 @@
833 docUri = "";
834 }
835
836-
837-/*******************************************************************************
838-
839-********************************************************************************/
840-
841-bool FnParseXmlFragmentIterator::nextImpl(store::Item_t& result, PlanState& planState) const
842+bool FnZorbaParseXmlFragmentIterator::nextImpl(store::Item_t& result, PlanState& planState) const
843 {
844 store::Store& lStore = GENV.getStore();
845 zstring docString;
846 store::Item_t tempItem;
847 bool validated = true;
848
849- FnParseXmlFragmentIteratorState* state;
850- DEFAULT_STACK_INIT(FnParseXmlFragmentIteratorState, state, planState);
851+ FnZorbaParseXmlFragmentIteratorState* state;
852+ DEFAULT_STACK_INIT(FnZorbaParseXmlFragmentIteratorState, state, planState);
853
854 if (consumeNext(result, theChildren[0].getp(), planState))
855 {
856@@ -311,5 +302,66 @@
857 }
858
859
860+/*******************************************************************************
861+ 14.9.2 fn:parse-xml-fragment
862+********************************************************************************/
863+/*
864+bool FnParseXmlFragmentIterator::nextImpl(store::Item_t& result, PlanState& planState) const
865+{
866+ zstring docString;
867+
868+ FnParseXmlFragmentIteratorState* state;
869+ DEFAULT_STACK_INIT(FnParseXmlFragmentIteratorState, state, planState);
870+
871+ if (consumeNext(result, theChildren[0].getp(), planState))
872+ {
873+ if (result->isStreamable())
874+ {
875+ state->theFragmentStream.theStream = &result->getStream();
876+ }
877+ else
878+ {
879+ result->getStringValue2(docString);
880+ state->theFragmentStream.theIss = new std::istringstream(docString.c_str());
881+ state->theFragmentStream.theStream = state->theFragmentStream.theIss;
882+ }
883+
884+ state->theProperties.setBaseUri(theSctx->get_base_uri());
885+ state->baseUri = state->theProperties.getBaseUri();
886+
887+ state->theProperties.setParseExternalParsedEntity(true);
888+
889+ while ( ! state->theFragmentStream.stream_is_consumed() )
890+ {
891+ try {
892+ state->theProperties.setStoreDocument(false);
893+ result = GENV.getStore().loadDocument(state->baseUri, state->docUri, state->theFragmentStream, state->theProperties);
894+ } catch (ZorbaException const& e) {
895+ if( ! state->theProperties.getNoError())
896+ throw XQUERY_EXCEPTION(err::FODC0006, ERROR_PARAMS("fn:parse-xml-fragment()", e.what() ), ERROR_LOC(loc));
897+ else
898+ result = NULL;
899+ }
900+
901+ if (result == NULL)
902+ continue;
903+
904+ STACK_PUSH(true, state);
905+ } // while
906+ } // if
907+
908+ STACK_END(state)
909+}
910+
911+void FnParseXmlFragmentIteratorState::reset(PlanState& planState)
912+{
913+ PlanIteratorState::reset(planState);
914+ theFragmentStream.reset();
915+ theProperties.reset();
916+ theProperties.setStoreDocument(false);
917+ baseUri = "";
918+ docUri = "";
919+}
920+*/
921
922 } /* namespace zorba */
923
924=== modified file 'src/runtime/parsing_and_serializing/parsing_and_serializing_impl.cpp'
925--- src/runtime/parsing_and_serializing/parsing_and_serializing_impl.cpp 2012-04-24 12:39:38 +0000
926+++ src/runtime/parsing_and_serializing/parsing_and_serializing_impl.cpp 2012-05-02 07:34:19 +0000
927@@ -118,7 +118,6 @@
928 STACK_END (state);
929 }
930
931-
932 /*******************************************************************************
933 14.9.2 fn:serialize
934 ********************************************************************************/
935
936=== modified file 'src/runtime/parsing_and_serializing/pregenerated/parse_fragment.cpp'
937--- src/runtime/parsing_and_serializing/pregenerated/parse_fragment.cpp 2012-04-24 12:39:38 +0000
938+++ src/runtime/parsing_and_serializing/pregenerated/parse_fragment.cpp 2012-05-02 07:34:19 +0000
939@@ -32,12 +32,12 @@
940
941 namespace zorba {
942
943-// <FnParseXmlFragmentIterator>
944-FnParseXmlFragmentIterator::class_factory<FnParseXmlFragmentIterator>
945-FnParseXmlFragmentIterator::g_class_factory;
946-
947-
948-void FnParseXmlFragmentIterator::accept(PlanIterVisitor& v) const {
949+// <FnZorbaParseXmlFragmentIterator>
950+FnZorbaParseXmlFragmentIterator::class_factory<FnZorbaParseXmlFragmentIterator>
951+FnZorbaParseXmlFragmentIterator::g_class_factory;
952+
953+
954+void FnZorbaParseXmlFragmentIterator::accept(PlanIterVisitor& v) const {
955 v.beginVisit(*this);
956
957 std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin();
958@@ -49,17 +49,17 @@
959 v.endVisit(*this);
960 }
961
962-FnParseXmlFragmentIterator::~FnParseXmlFragmentIterator() {}
963-
964-FnParseXmlFragmentIteratorState::FnParseXmlFragmentIteratorState() {}
965-
966-FnParseXmlFragmentIteratorState::~FnParseXmlFragmentIteratorState() {}
967-
968-
969-void FnParseXmlFragmentIteratorState::init(PlanState& planState) {
970+FnZorbaParseXmlFragmentIterator::~FnZorbaParseXmlFragmentIterator() {}
971+
972+FnZorbaParseXmlFragmentIteratorState::FnZorbaParseXmlFragmentIteratorState() {}
973+
974+FnZorbaParseXmlFragmentIteratorState::~FnZorbaParseXmlFragmentIteratorState() {}
975+
976+
977+void FnZorbaParseXmlFragmentIteratorState::init(PlanState& planState) {
978 PlanIteratorState::init(planState);
979 }
980-// </FnParseXmlFragmentIterator>
981+// </FnZorbaParseXmlFragmentIterator>
982
983
984
985
986=== modified file 'src/runtime/parsing_and_serializing/pregenerated/parse_fragment.h'
987--- src/runtime/parsing_and_serializing/pregenerated/parse_fragment.h 2012-04-24 12:39:38 +0000
988+++ src/runtime/parsing_and_serializing/pregenerated/parse_fragment.h 2012-05-02 07:34:19 +0000
989@@ -39,7 +39,7 @@
990 * fn-zorba-xml:parse
991 * Author: Zorba Team
992 */
993-class FnParseXmlFragmentIteratorState : public PlanIteratorState
994+class FnZorbaParseXmlFragmentIteratorState : public PlanIteratorState
995 {
996 public:
997 FragmentIStream theFragmentStream; //the input fragment
998@@ -47,37 +47,37 @@
999 zstring baseUri; //
1000 zstring docUri; //
1001
1002- FnParseXmlFragmentIteratorState();
1003+ FnZorbaParseXmlFragmentIteratorState();
1004
1005- ~FnParseXmlFragmentIteratorState();
1006+ ~FnZorbaParseXmlFragmentIteratorState();
1007
1008 void init(PlanState&);
1009 void reset(PlanState&);
1010 };
1011
1012-class FnParseXmlFragmentIterator : public NaryBaseIterator<FnParseXmlFragmentIterator, FnParseXmlFragmentIteratorState>
1013+class FnZorbaParseXmlFragmentIterator : public NaryBaseIterator<FnZorbaParseXmlFragmentIterator, FnZorbaParseXmlFragmentIteratorState>
1014 {
1015 public:
1016- SERIALIZABLE_CLASS(FnParseXmlFragmentIterator);
1017+ SERIALIZABLE_CLASS(FnZorbaParseXmlFragmentIterator);
1018
1019- SERIALIZABLE_CLASS_CONSTRUCTOR2T(FnParseXmlFragmentIterator,
1020- NaryBaseIterator<FnParseXmlFragmentIterator, FnParseXmlFragmentIteratorState>);
1021+ SERIALIZABLE_CLASS_CONSTRUCTOR2T(FnZorbaParseXmlFragmentIterator,
1022+ NaryBaseIterator<FnZorbaParseXmlFragmentIterator, FnZorbaParseXmlFragmentIteratorState>);
1023
1024 void serialize( ::zorba::serialization::Archiver& ar)
1025 {
1026 serialize_baseclass(ar,
1027- (NaryBaseIterator<FnParseXmlFragmentIterator, FnParseXmlFragmentIteratorState>*)this);
1028+ (NaryBaseIterator<FnZorbaParseXmlFragmentIterator, FnZorbaParseXmlFragmentIteratorState>*)this);
1029 }
1030
1031- FnParseXmlFragmentIterator(
1032+ FnZorbaParseXmlFragmentIterator(
1033 static_context* sctx,
1034 const QueryLoc& loc,
1035 std::vector<PlanIter_t>& children)
1036 :
1037- NaryBaseIterator<FnParseXmlFragmentIterator, FnParseXmlFragmentIteratorState>(sctx, loc, children)
1038+ NaryBaseIterator<FnZorbaParseXmlFragmentIterator, FnZorbaParseXmlFragmentIteratorState>(sctx, loc, children)
1039 {}
1040
1041- virtual ~FnParseXmlFragmentIterator();
1042+ virtual ~FnZorbaParseXmlFragmentIterator();
1043
1044 void accept(PlanIterVisitor& v) const;
1045
1046
1047=== modified file 'src/runtime/spec/accessors/accessors.xml'
1048--- src/runtime/spec/accessors/accessors.xml 2012-04-24 12:39:38 +0000
1049+++ src/runtime/spec/accessors/accessors.xml 2012-05-02 07:34:19 +0000
1050@@ -62,13 +62,16 @@
1051
1052 <zorba:function>
1053
1054+ <zorba:signature localname="nilled" prefix="fn" version="3.0">
1055+ <zorba:output>xs:boolean</zorba:output>
1056+ </zorba:signature>
1057 <zorba:signature localname="nilled" prefix="fn">
1058 <zorba:param>node()?</zorba:param>
1059 <zorba:output>xs:boolean?</zorba:output>
1060 </zorba:signature>
1061-
1062+
1063 <zorba:methods>
1064- <zorba:mustCopyInputNodes value="false"/>
1065+ <zorba:mustCopyInputNodes value="true"/>
1066 </zorba:methods>
1067
1068 </zorba:function>
1069
1070=== modified file 'src/runtime/spec/collections/collections.xml'
1071--- src/runtime/spec/collections/collections.xml 2012-04-24 12:39:38 +0000
1072+++ src/runtime/spec/collections/collections.xml 2012-05-02 07:34:19 +0000
1073@@ -1324,32 +1324,32 @@
1074 14.8.5 fn:uri-collection
1075 ********************************************************************************/
1076 -->
1077- <zorba:iterator name="FnURICollectionIterator">
1078- <zorba:description author="Zorba Team">
1079- Returns a sequence of xs:anyURI values representing the document URIs of the
1080- documents in a collection.
1081- </zorba:description>
1082-
1083- <zorba:function>
1084-
1085- <zorba:signature localname="uri-collection" prefix="fn" version="3.0">
1086- <zorba:output>xs:anyURI*</zorba:output>
1087- </zorba:signature>
1088-
1089- <zorba:signature localname="uri-collection" prefix="fn" version="3.0">
1090- <zorba:param>xs:string?</zorba:param>
1091- <zorba:output>xs:anyURI*</zorba:output>
1092- </zorba:signature>
1093-
1094- </zorba:function>
1095-
1096- <zorba:state generateInit="false" generateReset="false" generateDestructor="false">
1097- <zorba:member type="store::Iterator_t" name="theIterator"
1098- brief="the current iterator"/>
1099- <zorba:member type="bool" name="theIteratorOpened" defaultValue="false"
1100- brief="flag indicating whether theIterator was opened"/>
1101- </zorba:state>
1102+<zorba:iterator name="FnURICollectionIterator">
1103+ <zorba:description author="Zorba Team">
1104+ Returns a sequence of xs:anyURI values representing the document URIs of the
1105+ documents in a collection.
1106+ </zorba:description>
1107+
1108+ <zorba:function>
1109+
1110+ <zorba:signature localname="uri-collection" prefix="fn" version="3.0">
1111+ <zorba:output>xs:anyURI*</zorba:output>
1112+ </zorba:signature>
1113+
1114+ <zorba:signature localname="uri-collection" prefix="fn" version="3.0">
1115+ <zorba:param>xs:string?</zorba:param>
1116+ <zorba:output>xs:anyURI*</zorba:output>
1117+ </zorba:signature>
1118
1119- </zorba:iterator>
1120+ </zorba:function>
1121+
1122+ <zorba:state generateInit="false" generateReset="false" generateDestructor="false">
1123+ <zorba:member type="store::Iterator_t" name="theIterator"
1124+ brief="the current iterator"/>
1125+ <zorba:member type="bool" name="theIteratorOpened" defaultValue="false"
1126+ brief="flag indicating whether theIterator was opened"/>
1127+ </zorba:state>
1128+
1129+</zorba:iterator>
1130
1131 </zorba:iterators>
1132
1133=== modified file 'src/runtime/spec/nodes/nodes.xml'
1134--- src/runtime/spec/nodes/nodes.xml 2012-04-24 12:39:38 +0000
1135+++ src/runtime/spec/nodes/nodes.xml 2012-05-02 07:34:19 +0000
1136@@ -186,6 +186,11 @@
1137 <zorba:description author="Zorba Team">fn:has-children</zorba:description>
1138
1139 <zorba:function>
1140+
1141+ <zorba:signature localname="has-children" prefix="fn" version="3.0">
1142+ <zorba:output>xs:boolean</zorba:output>
1143+ </zorba:signature>
1144+
1145 <zorba:signature localname="has-children" prefix="fn" version="3.0">
1146 <zorba:param>node()?</zorba:param>
1147 <zorba:output>xs:boolean</zorba:output>
1148@@ -515,4 +520,26 @@
1149
1150 </zorba:iterator>
1151
1152+<!--
1153+/*******************************************************************************
1154+********************************************************************************/
1155+-->
1156+<zorba:iterator name="FnPathIterator">
1157+
1158+ <zorba:description author="Zorba Team"></zorba:description>
1159+
1160+ <zorba:function>
1161+ <zorba:signature localname="path" prefix="fn" version="3.0">
1162+ <zorba:output>xs:string?</zorba:output>
1163+ </zorba:signature>
1164+
1165+ <zorba:signature localname="path" prefix="fn" version="3.0">
1166+ <zorba:param>node()?</zorba:param>
1167+ <zorba:output>xs:string?</zorba:output>
1168+ </zorba:signature>
1169+
1170+ </zorba:function>
1171+
1172+</zorba:iterator>
1173+
1174 </zorba:iterators>
1175
1176=== modified file 'src/runtime/spec/parsing_and_serializing/parse_fragment.xml'
1177--- src/runtime/spec/parsing_and_serializing/parse_fragment.xml 2012-04-24 12:39:38 +0000
1178+++ src/runtime/spec/parsing_and_serializing/parse_fragment.xml 2012-05-02 07:34:19 +0000
1179@@ -22,7 +22,7 @@
1180 * 14.9.1 parse-xml:parse
1181 ********************************************************************************/
1182 -->
1183- <zorba:iterator name="FnParseXmlFragmentIterator">
1184+ <zorba:iterator name="FnZorbaParseXmlFragmentIterator">
1185
1186 <zorba:description author="Zorba Team">fn-zorba-xml:parse</zorba:description>
1187
1188@@ -46,6 +46,35 @@
1189 </zorba:state>
1190
1191 </zorba:iterator>
1192-
1193-
1194+<!--
1195+/*******************************************************************************
1196+ * 14.9.2 fn:parse-xml-fragment
1197+********************************************************************************/
1198+-->
1199+
1200+<!--
1201+<zorba:iterator name="FnParseXmlFragmentIterator">
1202+
1203+ <zorba:description author="Zorba Team">fn:parse-xml-fragment</zorba:description>
1204+
1205+ <zorba:function>
1206+ <zorba:signature localname="parse-xml-fragment" prefix="fn">
1207+ <zorba:param>xs:string?</zorba:param>
1208+ <zorba:output>node()*</zorba:output>
1209+ </zorba:signature>
1210+
1211+ <zorba:methods>
1212+ <zorba:accessesDynCtx returnValue="true"/>
1213+ </zorba:methods>
1214+ </zorba:function>
1215+
1216+ <zorba:state generateReset="false">
1217+ <zorba:member type="FragmentIStream" name="theFragmentStream" brief="the input fragment"/>
1218+ <zorba:member type="store::LoadProperties" name="theProperties" brief="loader properties"/>
1219+ <zorba:member type="zstring" name="baseUri"/>
1220+ <zorba:member type="zstring" name="docUri"/>
1221+ </zorba:state>
1222+
1223+</zorba:iterator>
1224+-->
1225 </zorba:iterators>
1226
1227=== modified file 'src/runtime/spec/parsing_and_serializing/parsing_and_serializing.xml'
1228--- src/runtime/spec/parsing_and_serializing/parsing_and_serializing.xml 2012-04-24 12:39:38 +0000
1229+++ src/runtime/spec/parsing_and_serializing/parsing_and_serializing.xml 2012-05-02 07:34:19 +0000
1230@@ -43,10 +43,9 @@
1231
1232 </zorba:iterator>
1233
1234-
1235 <!--
1236 /*******************************************************************************
1237- * 14.9.2 fn:serialize
1238+ * 14.9.3 fn:serialize
1239 ********************************************************************************/
1240 -->
1241 <zorba:iterator name="FnSerializeIterator">
1242@@ -79,5 +78,6 @@
1243 </zorba:method>
1244
1245 </zorba:iterator>
1246-
1247+
1248+
1249 </zorba:iterators>
1250
1251=== modified file 'src/runtime/visitors/pregenerated/planiter_visitor.h'
1252--- src/runtime/visitors/pregenerated/planiter_visitor.h 2012-04-27 01:23:43 +0000
1253+++ src/runtime/visitors/pregenerated/planiter_visitor.h 2012-05-02 07:34:19 +0000
1254@@ -436,6 +436,8 @@
1255
1256 class LeastCommonAncestor;
1257
1258+ class FnPathIterator;
1259+
1260 class AbsIterator;
1261
1262 class CeilingIterator;
1263@@ -450,7 +452,7 @@
1264
1265 class FormatIntegerIterator;
1266
1267- class FnParseXmlFragmentIterator;
1268+ class FnZorbaParseXmlFragmentIterator;
1269
1270 class FnParseXmlIterator;
1271
1272@@ -1259,6 +1261,9 @@
1273 virtual void beginVisit ( const LeastCommonAncestor& ) = 0;
1274 virtual void endVisit ( const LeastCommonAncestor& ) = 0;
1275
1276+ virtual void beginVisit ( const FnPathIterator& ) = 0;
1277+ virtual void endVisit ( const FnPathIterator& ) = 0;
1278+
1279 virtual void beginVisit ( const AbsIterator& ) = 0;
1280 virtual void endVisit ( const AbsIterator& ) = 0;
1281
1282@@ -1280,8 +1285,8 @@
1283 virtual void beginVisit ( const FormatIntegerIterator& ) = 0;
1284 virtual void endVisit ( const FormatIntegerIterator& ) = 0;
1285
1286- virtual void beginVisit ( const FnParseXmlFragmentIterator& ) = 0;
1287- virtual void endVisit ( const FnParseXmlFragmentIterator& ) = 0;
1288+ virtual void beginVisit ( const FnZorbaParseXmlFragmentIterator& ) = 0;
1289+ virtual void endVisit ( const FnZorbaParseXmlFragmentIterator& ) = 0;
1290
1291 virtual void beginVisit ( const FnParseXmlIterator& ) = 0;
1292 virtual void endVisit ( const FnParseXmlIterator& ) = 0;
1293
1294=== modified file 'src/runtime/visitors/pregenerated/printer_visitor.cpp'
1295--- src/runtime/visitors/pregenerated/printer_visitor.cpp 2012-04-24 18:22:23 +0000
1296+++ src/runtime/visitors/pregenerated/printer_visitor.cpp 2012-05-02 07:34:19 +0000
1297@@ -2870,6 +2870,20 @@
1298 // </LeastCommonAncestor>
1299
1300
1301+// <FnPathIterator>
1302+void PrinterVisitor::beginVisit ( const FnPathIterator& a) {
1303+ thePrinter.startBeginVisit("FnPathIterator", ++theId);
1304+ printCommons( &a, theId );
1305+ thePrinter.endBeginVisit( theId );
1306+}
1307+
1308+void PrinterVisitor::endVisit ( const FnPathIterator& ) {
1309+ thePrinter.startEndVisit();
1310+ thePrinter.endEndVisit();
1311+}
1312+// </FnPathIterator>
1313+
1314+
1315 // <AbsIterator>
1316 void PrinterVisitor::beginVisit ( const AbsIterator& a) {
1317 thePrinter.startBeginVisit("AbsIterator", ++theId);
1318@@ -2968,18 +2982,18 @@
1319 // </FormatIntegerIterator>
1320
1321
1322-// <FnParseXmlFragmentIterator>
1323-void PrinterVisitor::beginVisit ( const FnParseXmlFragmentIterator& a) {
1324- thePrinter.startBeginVisit("FnParseXmlFragmentIterator", ++theId);
1325+// <FnZorbaParseXmlFragmentIterator>
1326+void PrinterVisitor::beginVisit ( const FnZorbaParseXmlFragmentIterator& a) {
1327+ thePrinter.startBeginVisit("FnZorbaParseXmlFragmentIterator", ++theId);
1328 printCommons( &a, theId );
1329 thePrinter.endBeginVisit( theId );
1330 }
1331
1332-void PrinterVisitor::endVisit ( const FnParseXmlFragmentIterator& ) {
1333+void PrinterVisitor::endVisit ( const FnZorbaParseXmlFragmentIterator& ) {
1334 thePrinter.startEndVisit();
1335 thePrinter.endEndVisit();
1336 }
1337-// </FnParseXmlFragmentIterator>
1338+// </FnZorbaParseXmlFragmentIterator>
1339
1340
1341 // <FnParseXmlIterator>
1342
1343=== modified file 'src/runtime/visitors/pregenerated/printer_visitor.h'
1344--- src/runtime/visitors/pregenerated/printer_visitor.h 2012-04-24 18:22:23 +0000
1345+++ src/runtime/visitors/pregenerated/printer_visitor.h 2012-05-02 07:34:19 +0000
1346@@ -663,6 +663,9 @@
1347 void beginVisit( const LeastCommonAncestor& );
1348 void endVisit ( const LeastCommonAncestor& );
1349
1350+ void beginVisit( const FnPathIterator& );
1351+ void endVisit ( const FnPathIterator& );
1352+
1353 void beginVisit( const AbsIterator& );
1354 void endVisit ( const AbsIterator& );
1355
1356@@ -684,8 +687,8 @@
1357 void beginVisit( const FormatIntegerIterator& );
1358 void endVisit ( const FormatIntegerIterator& );
1359
1360- void beginVisit( const FnParseXmlFragmentIterator& );
1361- void endVisit ( const FnParseXmlFragmentIterator& );
1362+ void beginVisit( const FnZorbaParseXmlFragmentIterator& );
1363+ void endVisit ( const FnZorbaParseXmlFragmentIterator& );
1364
1365 void beginVisit( const FnParseXmlIterator& );
1366 void endVisit ( const FnParseXmlIterator& );

Subscribers

People subscribed via source and target branches