← Back to team overview

zorba-coders team mailing list archive

[Bug 912579] [NEW] Validate in place applied on non-root element produces an invalid xdm instance

 

Public bug reported:

If validate-in-place is called on a non-root element the resulting xdm
instance can be invalid since it may contain typed nodes as descendant
of untyped nodes.


Schema
<?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>

Query
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))

Result
xs:untyped rootType

** Affects: zorba
     Importance: High
     Assignee: Federico Cavalieri (fcavalieri)
         Status: New

-- 
You received this bug notification because you are a member of Zorba
Coders, which is the registrant for Zorba.
https://bugs.launchpad.net/bugs/912579

Title:
  Validate in place applied on non-root element produces an invalid xdm
  instance

Status in Zorba - The XQuery Processor:
  New

Bug description:
  If validate-in-place is called on a non-root element the resulting xdm
  instance can be invalid since it may contain typed nodes as descendant
  of untyped nodes.

  
  Schema
  <?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>

  Query
  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))

  Result
  xs:untyped rootType

To manage notifications about this bug go to:
https://bugs.launchpad.net/zorba/+bug/912579/+subscriptions


Follow ups

References