Merge lp:~zorba-coders/zorba/no-copy into lp:zorba

Proposed by Markos Zaharioudakis
Status: Merged
Approved by: Markos Zaharioudakis
Approved revision: 11077
Merged at revision: 11084
Proposed branch: lp:~zorba-coders/zorba/no-copy
Merge into: lp:zorba
Diff against target: 633 lines (+411/-39)
8 files modified
src/compiler/expression/expr_base.cpp (+24/-0)
src/compiler/expression/expr_base.h (+13/-4)
src/compiler/rewriter/rules/nodeid_rules.cpp (+336/-26)
src/compiler/rewriter/rules/ruleset.h (+3/-9)
test/rbkt/ExpQueryResults/zorba/no-copy/test4.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/no-copy/test5.xml.res (+1/-0)
test/rbkt/Queries/zorba/no-copy/test4.xq (+17/-0)
test/rbkt/Queries/zorba/no-copy/test5.xq (+16/-0)
To merge this branch: bzr merge lp:~zorba-coders/zorba/no-copy
Reviewer Review Type Date Requested Status
Markos Zaharioudakis Approve
Review via email: mp+127604@code.launchpad.net

Commit message

1. Put back markForSerialization() (renamed as markInUsafeContext())
2. path expr is unsafe if it contains any KindTest with type check and the construction mode i strip
3. copying is unsafe only if ns_inherit and ns_preserve

Description of the change

1. Put back markForSerialization() (renamed as markInUsafeContext())
2. path expr is unsafe if it contains any KindTest with type check and the construction mode i strip
3. copying is unsafe only if ns_inherit and ns_preserve

To post a comment you must log in.
lp:~zorba-coders/zorba/no-copy updated
11077. By Markos Zaharioudakis

put back markForSerialization() + path expr is unsafe if it contains any KindTest with type and the construction mode i strip + copying is unsafe only if ns_inherit and ns_preserve

Revision history for this message
Markos Zaharioudakis (markos-za) :
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 job no-copy-2012-10-02T22-59-53.733Z 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
=== modified file 'src/compiler/expression/expr_base.cpp'
--- src/compiler/expression/expr_base.cpp 2012-10-02 11:57:15 +0000
+++ src/compiler/expression/expr_base.cpp 2012-10-02 22:52:19 +0000
@@ -541,6 +541,30 @@
541/*******************************************************************************541/*******************************************************************************
542542
543********************************************************************************/543********************************************************************************/
544BoolAnnotationValue expr::getInUnsafeContext() const
545{
546 return (BoolAnnotationValue)
547 ((theFlags1 & IN_UNSAFE_CONTEXT_MASK) >> IN_UNSAFE_CONTEXT);
548}
549
550
551void expr::setInUnsafeContext(BoolAnnotationValue v)
552{
553 theFlags1 &= ~IN_UNSAFE_CONTEXT_MASK;
554 theFlags1 |= (v << IN_UNSAFE_CONTEXT);
555}
556
557
558bool expr::inUnsafeContext() const
559{
560 BoolAnnotationValue v = getInUnsafeContext();
561 return (v == ANNOTATION_TRUE || v == ANNOTATION_TRUE_FIXED);
562}
563
564
565/*******************************************************************************
566
567********************************************************************************/
544BoolAnnotationValue expr::getContainsPragma() const568BoolAnnotationValue expr::getContainsPragma() const
545{569{
546 return (BoolAnnotationValue)570 return (BoolAnnotationValue)
547571
=== modified file 'src/compiler/expression/expr_base.h'
--- src/compiler/expression/expr_base.h 2012-10-02 11:57:15 +0000
+++ src/compiler/expression/expr_base.h 2012-10-02 22:52:19 +0000
@@ -147,8 +147,9 @@
147 UNFOLDABLE = 10,147 UNFOLDABLE = 10,
148 CONTAINS_RECURSIVE_CALL = 12,148 CONTAINS_RECURSIVE_CALL = 12,
149 PROPAGATES_INPUT_NODES = 14,149 PROPAGATES_INPUT_NODES = 14,
150 MUST_COPY_NODES = 16,150 IN_UNSAFE_CONTEXT = 16,
151 CONTAINS_PRAGMA = 18151 MUST_COPY_NODES = 18,
152 CONTAINS_PRAGMA = 20
152 } Annotationkey;153 } Annotationkey;
153154
154 typedef enum155 typedef enum
@@ -161,8 +162,9 @@
161 UNFOLDABLE_MASK = 0xC00,162 UNFOLDABLE_MASK = 0xC00,
162 CONTAINS_RECURSIVE_CALL_MASK = 0x3000,163 CONTAINS_RECURSIVE_CALL_MASK = 0x3000,
163 PROPAGATES_INPUT_NODES_MASK = 0xC000,164 PROPAGATES_INPUT_NODES_MASK = 0xC000,
164 MUST_COPY_NODES_MASK = 0x30000,165 IN_UNSAFE_CONTEXT_MASK = 0x30000,
165 CONTAINS_PRAGMA_MASK = 0xC0000166 MUST_COPY_NODES_MASK = 0xC0000,
167 CONTAINS_PRAGMA_MASK = 0x300000
166 } AnnotationMask;168 } AnnotationMask;
167169
168170
@@ -313,6 +315,13 @@
313315
314 void setMustCopyNodes(BoolAnnotationValue v);316 void setMustCopyNodes(BoolAnnotationValue v);
315317
318 // Annotation : inUnsafeContext
319 BoolAnnotationValue getInUnsafeContext() const;
320
321 void setInUnsafeContext(BoolAnnotationValue v);
322
323 bool inUnsafeContext() const;
324
316 // Annotation : containsPragma325 // Annotation : containsPragma
317 BoolAnnotationValue getContainsPragma() const;326 BoolAnnotationValue getContainsPragma() const;
318327
319328
=== modified file 'src/compiler/rewriter/rules/nodeid_rules.cpp'
--- src/compiler/rewriter/rules/nodeid_rules.cpp 2012-10-02 11:57:15 +0000
+++ src/compiler/rewriter/rules/nodeid_rules.cpp 2012-10-02 22:52:19 +0000
@@ -600,11 +600,11 @@
600 // inherited from the referencing tree if N had been copied into that600 // inherited from the referencing tree if N had been copied into that
601 // tree. (On the other hand it is ok if the query result contains nodes601 // tree. (On the other hand it is ok if the query result contains nodes
602 // which are not shared but have shared descendants). To handle this,602 // which are not shared but have shared descendants). To handle this,
603 // we set theIsInUnsafeContext so that any exprs that (a) extract nodes603 // we call markInUnsafeContext() so that any exprs that (a) extract nodes
604 // out of input nodes and (b) may propagate the extracted nodes to the604 // out of input nodes and (b) may propagate the extracted nodes to the
605 // query result will be considered as unsafe and thus require that 605 // query result will be considered as unsafe and thus require that
606 // their input trees are standalone.606 // their input trees are standalone.
607 theIsInUnsafeContext = true;607 markInUnsafeContext(node);
608 }608 }
609 }609 }
610 else610 else
@@ -652,25 +652,11 @@
652 expr* node,652 expr* node,
653 UDFCallChain& udfCaller)653 UDFCallChain& udfCaller)
654{654{
655 TypeManager* tm = node->get_type_manager();
656 RootTypeManager& rtm = GENV_TYPESYSTEM;
657
658 bool savedIsInUnsafeContext = theIsInUnsafeContext;
659
660 if (theIsInUnsafeContext)
661 {
662 xqtref_t retType = node->get_return_type();
663
664 if (TypeOps::is_subtype(tm, *retType, *rtm.ANY_ATOMIC_TYPE_STAR))
665 theIsInUnsafeContext = false;
666 }
667
668 switch (node->get_expr_kind())655 switch (node->get_expr_kind())
669 {656 {
670 case const_expr_kind:657 case const_expr_kind:
671 case var_expr_kind:658 case var_expr_kind:
672 {659 {
673 theIsInUnsafeContext = savedIsInUnsafeContext;
674 return;660 return;
675 }661 }
676662
@@ -692,7 +678,8 @@
692678
693 static_context* sctx = e->get_sctx();679 static_context* sctx = e->get_sctx();
694680
695 if (sctx->preserve_mode() != StaticContextConsts::no_preserve_ns)681 if (sctx->preserve_mode() == StaticContextConsts::preserve_ns &&
682 sctx->inherit_mode() == StaticContextConsts::inherit_ns)
696 {683 {
697 csize numPairs = e->num_pairs();684 csize numPairs = e->num_pairs();
698 for (csize i = 0; i < numPairs; ++i)685 for (csize i = 0; i < numPairs; ++i)
@@ -717,7 +704,8 @@
717704
718 static_context* sctx = e->get_sctx();705 static_context* sctx = e->get_sctx();
719706
720 if (sctx->preserve_mode() != StaticContextConsts::no_preserve_ns)707 if (sctx->preserve_mode() == StaticContextConsts::preserve_ns &&
708 sctx->inherit_mode() == StaticContextConsts::inherit_ns)
721 {709 {
722 std::vector<expr*> sources;710 std::vector<expr*> sources;
723 theSourceFinder->findNodeSources(e->get_expr(), &udfCaller, sources);711 theSourceFinder->findNodeSources(e->get_expr(), &udfCaller, sources);
@@ -732,7 +720,7 @@
732 {720 {
733 relpath_expr* e = static_cast<relpath_expr *>(node);721 relpath_expr* e = static_cast<relpath_expr *>(node);
734722
735 if (theIsInUnsafeContext)723 if (e->inUnsafeContext())
736 {724 {
737 std::vector<expr*> sources;725 std::vector<expr*> sources;
738 theSourceFinder->findNodeSources((*e)[0], &udfCaller, sources);726 theSourceFinder->findNodeSources((*e)[0], &udfCaller, sources);
@@ -750,6 +738,7 @@
750738
751 if (axisKind != axis_kind_child &&739 if (axisKind != axis_kind_child &&
752 axisKind != axis_kind_descendant &&740 axisKind != axis_kind_descendant &&
741 axisKind != axis_kind_descendant_or_self &&
753 axisKind != axis_kind_self &&742 axisKind != axis_kind_self &&
754 axisKind != axis_kind_attribute)743 axisKind != axis_kind_attribute)
755 {744 {
@@ -758,12 +747,24 @@
758 markSources(sources);747 markSources(sources);
759 break;748 break;
760 }749 }
750 else
751 {
752 match_expr* matchExpr = axisExpr->getTest();
753
754 if (matchExpr->getTypeName() != NULL &&
755 node->get_sctx()->construction_mode() == StaticContextConsts::cons_strip)
756 {
757 std::vector<expr*> sources;
758 theSourceFinder->findNodeSources((*e)[0], &udfCaller, sources);
759 markSources(sources);
760 break;
761 }
762 }
761 }763 }
762 }764 }
763765
764 applyInternal(rCtx, (*e)[0], udfCaller);766 applyInternal(rCtx, (*e)[0], udfCaller);
765767
766 theIsInUnsafeContext = savedIsInUnsafeContext;
767 return;768 return;
768 }769 }
769770
@@ -846,7 +847,9 @@
846 {847 {
847 if (node->get_sctx()->construction_mode() == StaticContextConsts::cons_strip)848 if (node->get_sctx()->construction_mode() == StaticContextConsts::cons_strip)
848 {849 {
849 theIsInUnsafeContext = true;850 cast_or_castable_base_expr* e = static_cast<cast_or_castable_base_expr*>(node);
851
852 markInUnsafeContext(e->get_input());
850 }853 }
851854
852 break;855 break;
@@ -895,7 +898,8 @@
895898
896 static_context* sctx = e->get_sctx();899 static_context* sctx = e->get_sctx();
897900
898 if (sctx->preserve_mode() != StaticContextConsts::no_preserve_ns)901 if (sctx->preserve_mode() == StaticContextConsts::preserve_ns &&
902 sctx->inherit_mode() == StaticContextConsts::inherit_ns)
899 {903 {
900 std::vector<copy_clause*>::const_iterator ite = e->begin();904 std::vector<copy_clause*>::const_iterator ite = e->begin();
901 std::vector<copy_clause*>::const_iterator end = e->end();905 std::vector<copy_clause*>::const_iterator end = e->end();
@@ -1028,7 +1032,6 @@
10281032
1029 applyInternal(rCtx, udf->getBody(), dummyUdfCaller);1033 applyInternal(rCtx, udf->getBody(), dummyUdfCaller);
10301034
1031 theIsInUnsafeContext = savedIsInUnsafeContext;
1032 return;1035 return;
1033 }1036 }
10341037
@@ -1049,9 +1052,6 @@
1049 iter.next();1052 iter.next();
1050 }1053 }
10511054
1052
1053 theIsInUnsafeContext = savedIsInUnsafeContext;
1054
1055 return;1055 return;
1056}1056}
10571057
@@ -1090,5 +1090,315 @@
1090}1090}
10911091
10921092
1093/*******************************************************************************
1094 This method is called when an expr E1 satisfies a condition that may make a
1095 sub-expr E2 of E1 be unsafe, even though E2 by itself is safe.
1096
1097 This method marks as being in "unsafe context" any expr that may produce
1098 nodes which may be propagated into the result of E1.
1099********************************************************************************/
1100void MarkNodeCopyProps::markInUnsafeContext(expr* node)
1101{
1102 TypeManager* tm = node->get_type_manager();
1103 RootTypeManager& rtm = GENV_TYPESYSTEM;
1104
1105 xqtref_t retType = node->get_return_type();
1106
1107 if (TypeOps::is_subtype(tm, *retType, *rtm.ANY_ATOMIC_TYPE_STAR))
1108 return;
1109
1110 switch (node->get_expr_kind())
1111 {
1112 case const_expr_kind:
1113 {
1114 return;
1115 }
1116 case var_expr_kind:
1117 {
1118 var_expr* e = static_cast<var_expr*>(node);
1119
1120 switch (e->get_kind())
1121 {
1122 case var_expr::for_var:
1123 case var_expr::let_var:
1124 case var_expr::win_var:
1125 case var_expr::wincond_out_var:
1126 case var_expr::wincond_in_var:
1127 case var_expr::non_groupby_var:
1128 {
1129 if (!e->inUnsafeContext())
1130 {
1131 e->setInUnsafeContext(ANNOTATION_TRUE);
1132 markInUnsafeContext(e->get_domain_expr());
1133 }
1134 return;
1135 }
1136
1137 case var_expr::copy_var:
1138 case var_expr::catch_var:
1139 {
1140 e->setInUnsafeContext(ANNOTATION_TRUE);
1141 return;
1142 }
1143
1144 case var_expr::arg_var:
1145 {
1146 e->setInUnsafeContext(ANNOTATION_TRUE);
1147 return;
1148 }
1149
1150 case var_expr::prolog_var:
1151 case var_expr::local_var:
1152 {
1153 if (!e->inUnsafeContext())
1154 {
1155 e->setInUnsafeContext(ANNOTATION_TRUE);
1156
1157 std::vector<expr*>::const_iterator ite = e->setExprsBegin();
1158 std::vector<expr*>::const_iterator end = e->setExprsEnd();
1159
1160 for (; ite != end; ++ite)
1161 {
1162 expr* setExpr = *ite;
1163
1164 if (setExpr->get_expr_kind() == var_decl_expr_kind)
1165 {
1166 markInUnsafeContext(static_cast<var_decl_expr*>(setExpr)->get_init_expr());
1167 }
1168 else
1169 {
1170 assert(setExpr->get_expr_kind() == var_set_expr_kind);
1171
1172 markInUnsafeContext(static_cast<var_set_expr*>(setExpr)->get_expr());
1173 }
1174 }
1175 }
1176 return;
1177 }
1178
1179 case var_expr::groupby_var:
1180 case var_expr::wincond_in_pos_var:
1181 case var_expr::wincond_out_pos_var:
1182 case var_expr::pos_var:
1183 case var_expr::score_var:
1184 case var_expr::count_var:
1185 default:
1186 {
1187 ZORBA_ASSERT(false);
1188 return;
1189 }
1190 }
1191 }
1192
1193 case doc_expr_kind:
1194 case elem_expr_kind:
1195 case attr_expr_kind:
1196 case text_expr_kind:
1197 case pi_expr_kind:
1198 {
1199 break;
1200 }
1201
1202#ifdef ZORBA_WITH_JSON
1203 case json_object_expr_kind:
1204 case json_direct_object_expr_kind:
1205 case json_array_expr_kind:
1206 {
1207 break;
1208 }
1209#endif
1210
1211 case relpath_expr_kind:
1212 {
1213 relpath_expr* e = static_cast<relpath_expr *>(node);
1214 e->setInUnsafeContext(ANNOTATION_TRUE);
1215 markInUnsafeContext((*e)[0]);
1216 return;
1217 }
1218
1219 case gflwor_expr_kind:
1220 case flwor_expr_kind:
1221 {
1222 flwor_expr* e = static_cast<flwor_expr *>(node);
1223 e->setInUnsafeContext(ANNOTATION_TRUE);
1224 markInUnsafeContext(e->get_return_expr());
1225 return;
1226 }
1227
1228 case if_expr_kind:
1229 case trycatch_expr_kind:
1230 {
1231 break;
1232 }
1233
1234 case fo_expr_kind:
1235 {
1236 fo_expr* e = static_cast<fo_expr *>(node);
1237 function* f = e->get_func();
1238
1239 e->setInUnsafeContext(ANNOTATION_TRUE);
1240
1241 if (f->isUdf() && static_cast<user_function*>(f)->getBody() != NULL)
1242 {
1243 user_function* udf = static_cast<user_function*>(f);
1244 expr* body = udf->getBody();
1245
1246 if (!body->inUnsafeContext())
1247 {
1248 markInUnsafeContext(body);
1249 }
1250
1251 std::vector<var_expr*>::const_iterator ite = udf->getArgVars().begin();
1252 std::vector<var_expr*>::const_iterator end = udf->getArgVars().end();
1253 for (; ite != end; ++ite)
1254 {
1255 expr* argVar = (*ite);
1256 if (argVar->inUnsafeContext())
1257 {
1258 expr* argExpr = e->get_arg(ite - udf->getArgVars().begin());
1259 markInUnsafeContext(argExpr);
1260 }
1261 }
1262 } // f->isUdf()
1263 else
1264 {
1265 csize numArgs = e->num_args();
1266 for (csize i = 0; i < numArgs; ++i)
1267 {
1268 if (f->propagatesInputNodes(e, i))
1269 {
1270 markInUnsafeContext(e->get_arg(i));
1271 }
1272 }
1273 }
1274
1275 return;
1276 }
1277
1278 case treat_expr_kind:
1279 case order_expr_kind:
1280 case wrapper_expr_kind:
1281 case function_trace_expr_kind:
1282 case extension_expr_kind:
1283 {
1284 break;
1285 }
1286
1287 case validate_expr_kind:
1288 {
1289 node->setInUnsafeContext(ANNOTATION_TRUE);
1290 return;
1291 }
1292
1293 case transform_expr_kind:
1294 {
1295 transform_expr* e = static_cast<transform_expr *>(node);
1296 e->setInUnsafeContext(ANNOTATION_TRUE);
1297 markInUnsafeContext(e->getReturnExpr());
1298 return;
1299 }
1300
1301 case block_expr_kind:
1302 {
1303 block_expr* e = static_cast<block_expr *>(node);
1304 e->setInUnsafeContext(ANNOTATION_TRUE);
1305 expr* lastChild = (*e)[e->size()-1];
1306 markInUnsafeContext(lastChild);
1307 return;
1308 }
1309
1310 case var_decl_expr_kind:
1311 case var_set_expr_kind:
1312 {
1313 return;
1314 }
1315
1316 case apply_expr_kind:
1317 {
1318 break;
1319 }
1320
1321 case exit_catcher_expr_kind:
1322 {
1323 exit_catcher_expr* e = static_cast<exit_catcher_expr*>(node);
1324
1325 std::vector<expr*>::const_iterator ite = e->exitExprsBegin();
1326 std::vector<expr*>::const_iterator end = e->exitExprsEnd();
1327
1328 for (; ite != end; ++ite)
1329 {
1330 exit_expr* ex = static_cast<exit_expr*>(*ite);
1331
1332 markInUnsafeContext(ex->get_expr());
1333 }
1334
1335 break;
1336 }
1337
1338
1339 case eval_expr_kind:
1340 {
1341 break;
1342 }
1343
1344 case debugger_expr_kind:
1345 {
1346 break; // ????
1347 }
1348
1349 case dynamic_function_invocation_expr_kind:
1350 {
1351 break;
1352 }
1353
1354 case function_item_expr_kind:
1355 {
1356 function_item_expr* e = static_cast<function_item_expr*>(node);
1357
1358 user_function* udf = static_cast<user_function*>(e->get_function());
1359
1360 markInUnsafeContext(udf->getBody());
1361
1362 return;
1363 }
1364
1365 case promote_expr_kind:
1366 case castable_expr_kind:
1367 case cast_expr_kind:
1368 case instanceof_expr_kind:
1369 case name_cast_expr_kind:
1370 case axis_step_expr_kind:
1371 case match_expr_kind:
1372 case delete_expr_kind:
1373 case rename_expr_kind:
1374 case insert_expr_kind:
1375 case replace_expr_kind:
1376 case while_expr_kind:
1377 case flowctl_expr_kind:
1378 case exit_expr_kind:
1379#ifndef ZORBA_NO_FULL_TEXT
1380 case ft_expr_kind:
1381#endif
1382 default:
1383 ZORBA_ASSERT(false);
1384 }
1385
1386 node->setInUnsafeContext(ANNOTATION_TRUE);
1387
1388 ExprIterator iter(node);
1389 while(!iter.done())
1390 {
1391 expr* child = (**iter);
1392 if (child != NULL)
1393 {
1394 markInUnsafeContext(child);
1395 }
1396 iter.next();
1397 }
1398
1399 return;
1400}
1401
1402
1093}1403}
1094/* vim:set et sw=2 ts=2: */1404/* vim:set et sw=2 ts=2: */
10951405
=== modified file 'src/compiler/rewriter/rules/ruleset.h'
--- src/compiler/rewriter/rules/ruleset.h 2012-10-02 11:57:15 +0000
+++ src/compiler/rewriter/rules/ruleset.h 2012-10-02 22:52:19 +0000
@@ -125,11 +125,6 @@
125125
126/*******************************************************************************126/*******************************************************************************
127127
128 theIsInUnsafeContext:
129 ---------------------
130 If true, it indicates that an expr E1 satisfies a condition that makes a
131 sub-expr E2 of E1 be unsafe, even though E2 by itself is safe.
132
133********************************************************************************/128********************************************************************************/
134class MarkNodeCopyProps : public RewriteRule129class MarkNodeCopyProps : public RewriteRule
135{130{
@@ -140,13 +135,10 @@
140135
141 UdfCalls theProcessedUDFCalls;136 UdfCalls theProcessedUDFCalls;
142137
143 bool theIsInUnsafeContext;
144
145public:138public:
146 MarkNodeCopyProps()139 MarkNodeCopyProps()
147 :140 :
148 RewriteRule(RewriteRule::MarkNodeCopyProps, "MarkNodeCopyProps"),141 RewriteRule(RewriteRule::MarkNodeCopyProps, "MarkNodeCopyProps")
149 theIsInUnsafeContext(false)
150 {142 {
151 }143 }
152144
@@ -156,6 +148,8 @@
156 void applyInternal(RewriterContext& rCtx, expr* node, UDFCallChain& udfCaller);148 void applyInternal(RewriterContext& rCtx, expr* node, UDFCallChain& udfCaller);
157149
158 void markSources(const std::vector<expr*>& sources);150 void markSources(const std::vector<expr*>& sources);
151
152 void markInUnsafeContext(expr* node);
159};153};
160154
161155
162156
=== added file 'test/rbkt/ExpQueryResults/zorba/no-copy/test4.xml.res'
--- test/rbkt/ExpQueryResults/zorba/no-copy/test4.xml.res 1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/no-copy/test4.xml.res 2012-10-02 22:52:19 +0000
@@ -0,0 +1,1 @@
1<s:name xmlns:s="http://www.zorba-xquery.org/simple">foo</s:name>
02
=== added file 'test/rbkt/ExpQueryResults/zorba/no-copy/test5.xml.res'
--- test/rbkt/ExpQueryResults/zorba/no-copy/test5.xml.res 1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/no-copy/test5.xml.res 2012-10-02 22:52:19 +0000
@@ -0,0 +1,1 @@
1<s:name xmlns:s="http://www.zorba-xquery.org/simple">foo</s:name> true
02
=== added file 'test/rbkt/Queries/zorba/no-copy/test4.xq'
--- test/rbkt/Queries/zorba/no-copy/test4.xq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/no-copy/test4.xq 2012-10-02 22:52:19 +0000
@@ -0,0 +1,17 @@
1
2declare namespace opt = "http://www.zorba-xquery.com/options/optimizer";
3
4declare construction strip;
5
6declare copy-namespaces preserve, no-inherit;
7
8
9import schema namespace s="http://www.zorba-xquery.org/simple" at "simple.xsd";
10
11declare option opt:enable "for-serialization-only";
12
13declare variable $doc := <s:person><s:name>foo</s:name><s:age>25</s:age></s:person>;
14
15let $vdoc := validate { $doc }
16let $copy := <root>{$vdoc/s:name}</root>
17return $copy/child::element(*, xs:untyped)
018
=== added file 'test/rbkt/Queries/zorba/no-copy/test5.xq'
--- test/rbkt/Queries/zorba/no-copy/test5.xq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/no-copy/test5.xq 2012-10-02 22:52:19 +0000
@@ -0,0 +1,16 @@
1declare namespace opt = "http://www.zorba-xquery.com/options/optimizer";
2
3declare construction strip;
4
5declare copy-namespaces preserve, no-inherit;
6
7import schema namespace s="http://www.zorba-xquery.org/simple" at "simple.xsd";
8
9declare option opt:enable "for-serialization-only";
10
11declare variable $doc := <s:person><s:name>foo</s:name><s:age>25</s:age></s:person>;
12
13let $vdoc := validate { $doc }
14let $copy := <root>{$vdoc/s:name}</root>
15let $copyname := $copy/s:name
16return ($copyname, " ", $copyname instance of element(*, xs:string))

Subscribers

People subscribed via source and target branches