zorba-coders team mailing list archive
-
zorba-coders team
-
Mailing list archive
-
Message #05574
[Merge] lp:~zorba-coders/zorba/bug-912579 into lp:zorba
Cezar Andrei has proposed merging lp:~zorba-coders/zorba/bug-912579 into lp:zorba.
Requested reviews:
Cezar Andrei (cezar-andrei)
Markos Zaharioudakis (markos-za)
Related bugs:
Bug #912579 in Zorba: "Validate in place applied on non-root element produces an invalid xdm instance"
https://bugs.launchpad.net/zorba/+bug/912579
For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/bug-912579/+merge/95259
Fixed bug #912579 (validate-in-place on non-root elements)
Fixed merge of updput primitives
Fixed merge conflict.
--
https://code.launchpad.net/~zorba-coders/zorba/bug-912579/+merge/95259
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'ChangeLog'
--- ChangeLog 2012-02-29 17:15:09 +0000
+++ ChangeLog 2012-02-29 20:57:28 +0000
@@ -56,6 +56,7 @@
* Fixed bug #918157 (Add XQFTTS to validation queue)
* Fixed bug with unversioned modules with C++ external functions
* Fixed bug #878508 (JSON Module not escaping escape characters)
+ * Fixed bug #912579 (validate-in-place on non-root elements)
version 2.1
=== modified file 'include/zorba/pregenerated/diagnostic_list.h'
--- include/zorba/pregenerated/diagnostic_list.h 2012-02-16 14:11:02 +0000
+++ include/zorba/pregenerated/diagnostic_list.h 2012-02-29 20:57:28 +0000
@@ -510,6 +510,8 @@
extern ZORBA_DLL_PUBLIC ZorbaErrorCode ZAPI0080_CANNOT_RETRIEVE_NODE_REFERENCE;
+extern ZORBA_DLL_PUBLIC ZorbaErrorCode ZAPI0090_CANNOT_VALIDATE_NON_ROOT;
+
extern ZORBA_DLL_PUBLIC ZorbaErrorCode ZCSE0001_NONEXISTENT_INPUT_FIELD;
extern ZORBA_DLL_PUBLIC ZorbaErrorCode ZCSE0002_INCOMPATIBLE_INPUT_FIELD;
=== modified file 'modules/com/zorba-xquery/www/modules/pregenerated/errors.xq'
--- modules/com/zorba-xquery/www/modules/pregenerated/errors.xq 2012-02-16 14:11:02 +0000
+++ modules/com/zorba-xquery/www/modules/pregenerated/errors.xq 2012-02-29 20:57:28 +0000
@@ -321,6 +321,10 @@
(:~
:)
+declare variable $zerr:ZAPI0090 as xs:QName := fn:QName($zerr:NS, "zerr:ZAPI0090");
+
+(:~
+:)
declare variable $zerr:ZCSE0001 as xs:QName := fn:QName($zerr:NS, "zerr:ZCSE0001");
(:~
=== modified file 'src/diagnostics/diagnostic_en.xml'
--- src/diagnostics/diagnostic_en.xml 2012-02-28 20:45:43 +0000
+++ src/diagnostics/diagnostic_en.xml 2012-02-29 20:57:28 +0000
@@ -1832,6 +1832,10 @@
<diagnostic code="ZAPI0080" name="CANNOT_RETRIEVE_NODE_REFERENCE">
<value>can not retrieve node-reference for a node that is not in a collection.</value>
</diagnostic>
+
+ <diagnostic code="ZAPI0090" name="CANNOT_VALIDATE_NON_ROOT">
+ <value>a non root element cannot be validated in place.</value>
+ </diagnostic>
<!--////////// Zorba Class Serialization Errors ////////////////////////-->
=== modified file 'src/diagnostics/pregenerated/diagnostic_list.cpp'
--- src/diagnostics/pregenerated/diagnostic_list.cpp 2012-02-16 14:11:02 +0000
+++ src/diagnostics/pregenerated/diagnostic_list.cpp 2012-02-29 20:57:28 +0000
@@ -744,6 +744,9 @@
ZorbaErrorCode ZAPI0080_CANNOT_RETRIEVE_NODE_REFERENCE( "ZAPI0080" );
+ZorbaErrorCode ZAPI0090_CANNOT_VALIDATE_NON_ROOT( "ZAPI0090" );
+
+
ZorbaErrorCode ZCSE0001_NONEXISTENT_INPUT_FIELD( "ZCSE0001" );
=== modified file 'src/diagnostics/pregenerated/dict_en.cpp'
--- src/diagnostics/pregenerated/dict_en.cpp 2012-02-28 20:45:43 +0000
+++ src/diagnostics/pregenerated/dict_en.cpp 2012-02-29 20:57:28 +0000
@@ -248,6 +248,7 @@
{ "ZAPI0042", "iterator is closed" },
{ "ZAPI0070", "\"$1\": invalid serialization method for SAX" },
{ "ZAPI0080", "can not retrieve node-reference for a node that is not in a collection." },
+ { "ZAPI0090", "a non root element cannot be validated in place." },
{ "ZCSE0001", "\"$1\": nonexistent input field" },
{ "ZCSE0002", "\"$1\": incompatible input field${: type=2}${, class=3}" },
{ "ZCSE0003", "\"$1\": unrecognized class field" },
=== modified file 'src/runtime/schema/schema_impl.cpp'
--- src/runtime/schema/schema_impl.cpp 2011-10-13 19:44:33 +0000
+++ src/runtime/schema/schema_impl.cpp 2012-02-29 20:57:28 +0000
@@ -93,6 +93,12 @@
if (consumeNext(node, theChild.getp(), planState))
{
+ // verify that if the element being revalidated is an element it is the root
+ if (node->getNodeKind()==store::StoreConsts::elementNode &&
+ node->getParent() &&
+ node->getParent()->getNodeKind()!=store::StoreConsts::documentNode)
+ throw XQUERY_EXCEPTION( zerr::ZAPI0090_CANNOT_VALIDATE_NON_ROOT, ERROR_LOC( loc ) );
+
pul = GENV_ITEMFACTORY->createPendingUpdateList();
pul->addRevalidate(&loc,node);
=== modified file 'src/store/naive/simple_pul.cpp'
--- src/store/naive/simple_pul.cpp 2012-02-22 16:45:50 +0000
+++ src/store/naive/simple_pul.cpp 2012-02-29 20:57:28 +0000
@@ -1205,6 +1205,7 @@
}
thePutList.push_back(otherUpd);
+ otherUpd->thePul = this;
otherp->thePutList[i] = NULL;
}
=== added file 'test/rbkt/Queries/zorba/schemas/val-inplace-err2.spec'
--- test/rbkt/Queries/zorba/schemas/val-inplace-err2.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/schemas/val-inplace-err2.spec 2012-02-29 20:57:28 +0000
@@ -0,0 +1,1 @@
+Error: http://www.zorba-xquery.com/errors:ZAPI0090
=== added file 'test/rbkt/Queries/zorba/schemas/val-inplace-err2.xq'
--- test/rbkt/Queries/zorba/schemas/val-inplace-err2.xq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/schemas/val-inplace-err2.xq 2012-02-29 20:57:28 +0000
@@ -0,0 +1,23 @@
+import module namespace schema = "http://www.zorba-xquery.com/modules/schema";
+import module namespace doc = "http://www.zorba-xquery.com/modules/store/dynamic/documents";
+import schema namespace d="http://www.zorba-xquery.org/schema" at "val-inplace-err2.xsd";
+
+declare revalidation lax;
+declare construction strip;
+
+declare variable $doc2:=<root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="http://www.zorba-xquery.org/schema">
+ <root>
+ <a/>
+ <b/>
+ <c/>
+ </root>
+ <a/>
+ <b/>
+ <c/>
+</root>;
+
+schema:validate-in-place($doc2/d:root);
+
+
+(schema:schema-type($doc2), schema:schema-type($doc2/d:root))
\ No newline at end of file
=== added file 'test/rbkt/Queries/zorba/schemas/val-inplace-err2.xsd'
--- test/rbkt/Queries/zorba/schemas/val-inplace-err2.xsd 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/schemas/val-inplace-err2.xsd 2012-02-29 20:57:28 +0000
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.zorba-xquery.org/schema" xmlns="http://www.zorba-xquery.org/schema"
+ elementFormDefault="qualified">
+
+ <xs:element name="root" type="rootType"/>
+
+ <xs:complexType name="rootType">
+ <xs:sequence>
+ <xs:element name="root" type="rootType" minOccurs="0"/>
+ <xs:element name="a" type="xs:string"/>
+ <xs:element name="b" type="xs:string"/>
+ <xs:element name="c" type="xs:string"/>
+ </xs:sequence>
+ <xs:attribute name="attr" type="xs:string"/>
+ </xs:complexType>
+
+</xs:schema>
\ No newline at end of file
Follow ups