Public bug reported: validate-in-place can set incorrect types. The following query should produce a "smallEl" with type "smallEl", but it produces a "smallEl" typed as "bigEl".
import module namespace schema = "http://www.zorba-xquery.com/modules/schema"; import schema namespace d="http://www.example.com/doc" at "test23.xsd"; import module namespace file = "http://expath.org/ns/file"; declare revalidation lax; variable $doc:=<items xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.zorba-xquery.org/schema"> <bigEl> <a>old</a> </bigEl> </items>; ( schema:validate-in-place($doc), rename node $doc/*:bigEl as QName("http://www.zorba-xquery.org/schema","smallEl") ); for $x in ($doc//*) return (<node name="{node-name($x)}" type="{schema:schema-type($x)}"/>) Schema <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="items"> <xs:complexType> <xs:choice maxOccurs="unbounded"> <xs:element name="bigEl" type="bigEl"/> <xs:element name="smallEl" type="smallEl"/> </xs:choice> </xs:complexType> </xs:element> <xs:complexType name="bigEl"> <xs:sequence> <xs:element name="a" type="xs:string"/> </xs:sequence> </xs:complexType> <xs:complexType name="smallEl"> <xs:sequence> <xs:element name="a" type="xs:string"/> </xs:sequence> </xs:complexType> </xs:schema> ** Affects: zorba Importance: High Assignee: Federico Cavalieri (fcavalieri) Status: New ** Changed in: zorba Importance: Undecided => High ** Changed in: zorba Assignee: (unassigned) => Federico Cavalieri (fcavalieri) ** Description changed: validate-in-place can set incorrect types. The following query should produce a "smallEl" with type "smallEl", but it produces a "smallEl" typed as "bigEl". import module namespace schema = "http://www.zorba-xquery.com/modules/schema"; import schema namespace d="http://www.example.com/doc" at "test23.xsd"; import module namespace file = "http://expath.org/ns/file"; declare revalidation lax; variable $doc:=<items xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns="http://www.zorba-xquery.org/schema"> - <bigEl> - <a>old</a> - </bigEl> + xmlns="http://www.zorba-xquery.org/schema"> + <bigEl> + <a>old</a> + </bigEl> </items>; ( - schema:validate-in-place($doc), - rename node $doc/*:bigEl as QName("http://www.zorba-xquery.org/schema","smallEl") + schema:validate-in-place($doc), + rename node $doc/*:bigEl as QName("http://www.zorba-xquery.org/schema","smallEl") ); for $x in ($doc//*) return (<node name="{node-name($x)}" type="{schema:schema-type($x)}"/>) + Schema + <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"> - Schema - import module namespace schema = "http://www.zorba-xquery.com/modules/schema"; - import schema namespace d="http://www.example.com/doc" at "test23.xsd"; - import module namespace file = "http://expath.org/ns/file"; - declare revalidation lax; + <xs:element name="items"> + <xs:complexType> + <xs:choice maxOccurs="unbounded"> + <xs:element name="bigEl" type="bigEl"/> + <xs:element name="smallEl" type="smallEl"/> + </xs:choice> + </xs:complexType> + </xs:element> - variable $doc:=<items xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns="http://www.zorba-xquery.org/schema"> - <bigEl> - <a>old</a> - </bigEl> - </items>; + <xs:complexType name="bigEl"> + <xs:sequence> + <xs:element name="a" type="xs:string"/> + </xs:sequence> + </xs:complexType> - ( - schema:validate-in-place($doc), - rename node $doc/*:bigEl as QName("http://www.zorba-xquery.org/schema","smallEl") - ); + <xs:complexType name="smallEl"> + <xs:sequence> + <xs:element name="a" type="xs:string"/> + </xs:sequence> + </xs:complexType> - for $x in ($doc//*) - return (<node name="{node-name($x)}" type="{schema:schema-type($x)}"/>) + + </xs:schema> -- You received this bug notification because you are a member of Zorba Coders, which is the registrant for Zorba. https://bugs.launchpad.net/bugs/872799 Title: validate-in-place can set incorrect types Status in Zorba - The XQuery Processor: New Bug description: validate-in-place can set incorrect types. The following query should produce a "smallEl" with type "smallEl", but it produces a "smallEl" typed as "bigEl". import module namespace schema = "http://www.zorba-xquery.com/modules/schema"; import schema namespace d="http://www.example.com/doc" at "test23.xsd"; import module namespace file = "http://expath.org/ns/file"; declare revalidation lax; variable $doc:=<items xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.zorba-xquery.org/schema"> <bigEl> <a>old</a> </bigEl> </items>; ( schema:validate-in-place($doc), rename node $doc/*:bigEl as QName("http://www.zorba-xquery.org/schema","smallEl") ); for $x in ($doc//*) return (<node name="{node-name($x)}" type="{schema:schema-type($x)}"/>) Schema <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="items"> <xs:complexType> <xs:choice maxOccurs="unbounded"> <xs:element name="bigEl" type="bigEl"/> <xs:element name="smallEl" type="smallEl"/> </xs:choice> </xs:complexType> </xs:element> <xs:complexType name="bigEl"> <xs:sequence> <xs:element name="a" type="xs:string"/> </xs:sequence> </xs:complexType> <xs:complexType name="smallEl"> <xs:sequence> <xs:element name="a" type="xs:string"/> </xs:sequence> </xs:complexType> </xs:schema> To manage notifications about this bug go to: https://bugs.launchpad.net/zorba/+bug/872799/+subscriptions -- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp