You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by "Alexey Miroshnichenko (JIRA)" <xe...@xml.apache.org> on 2007/05/19 01:38:16 UTC

[jira] Created: (XERCESC-1707) Processing of not-declared-element with "xsi:type" under anyType element does not clear SchemaValidator::fXsiType

Processing of not-declared-element with "xsi:type" under anyType element does not clear SchemaValidator::fXsiType
-----------------------------------------------------------------------------------------------------------------

                 Key: XERCESC-1707
                 URL: https://issues.apache.org/jira/browse/XERCESC-1707
             Project: Xerces-C++
          Issue Type: Bug
          Components: Validating Parser (Schema) (Xerces 1.5 or up only)
    Affects Versions: 2.6.0, 2.7.0
            Reporter: Alexey Miroshnichenko


input.xml
=================
<?xml version="1.0" encoding="UTF-8"?>
<purchaseOrder xmlns="http://www.openuri.org/mySchema" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://www.openuri.org/mySchema xsd.xsd">
	<shipTo>
		<name>ship-to-name</name>
		<element_of_any_type>
			<unknown_element xsi:type="USState">AK</unknown_element>
		</element_of_any_type>
	</shipTo>
	<billTo>
		<name>bill-to-name</name>
		<element_of_any_type/>
	</billTo>
</purchaseOrder>
=================

xsd.xsd
=================
<?xml version="1.0"?>
<xsd:schema xmlns="http://www.openuri.org/mySchema" 
            elementFormDefault="qualified" 
            targetNamespace="http://www.openuri.org/mySchema"
            xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            >
  <xsd:element name="purchaseOrder" type="PurchaseOrderType" />
  <xsd:complexType name="PurchaseOrderType">
    <xsd:sequence>
      <xsd:element name="shipTo" type="USAddress" />
      <xsd:element name="billTo" type="USAddress" />
    </xsd:sequence>
  </xsd:complexType>
  <xsd:complexType name="USAddress">
    <xsd:sequence>
      <xsd:element name="name" type="xsd:string" />
      <xsd:element name="element_of_any_type"/>
    </xsd:sequence>
	<!-- declaration of this attribute is necesary to reproduce -->
    <xsd:attribute fixed="US" name="country" type="xsd:NMTOKEN" />
  </xsd:complexType>
  <xsd:simpleType name="USState">
	<xsd:restriction base="xsd:string">
		<xsd:enumeration value="AK"/>
		<xsd:enumeration value="AL"/>
	</xsd:restriction>
  </xsd:simpleType>
</xsd:schema>
=================

Validation of input.xml reports follow error:
Error at file input.xml, line 11, char 10
  Message: Type 'USState' that is used in xsi:type is not derived from the type of element 'billTo'

reason for this behavior is that SchemaValidator::fXsiType is not cleared after element "unknown_element" processing.


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org


[jira] Updated: (XERCESC-1707) Processing of not-declared-element with "xsi:type" under anyType element does not clear SchemaValidator::fXsiType

Posted by "Anton Nikolaevsky (JIRA)" <xe...@xml.apache.org>.
     [ https://issues.apache.org/jira/browse/XERCESC-1707?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Anton Nikolaevsky updated XERCESC-1707:
---------------------------------------

    Attachment: XsiType.diff

It seems SchemaValidator::fXsiType is not used in such cases (meaning unknown element lax processing), so validation of its content in compliance with specified in xsi:type type is not performed (but supposed to!). BTW, SchemaValidator::fXsiType is cleared exactly in SchemaValidator::validateElement which is currently not called during unknown element lax processing (fValidate is set to false) . 

Another issue: formatted content model for error description is built from a complex type info of an element declaration only ignoring xsi:type presence, i.e. formatted content model from error description may differ from real data content model.

Proposed fix for both issues is attached.

> Processing of not-declared-element with "xsi:type" under anyType element does not clear SchemaValidator::fXsiType
> -----------------------------------------------------------------------------------------------------------------
>
>                 Key: XERCESC-1707
>                 URL: https://issues.apache.org/jira/browse/XERCESC-1707
>             Project: Xerces-C++
>          Issue Type: Bug
>          Components: Validating Parser (Schema) (Xerces 1.5 or up only)
>    Affects Versions: 2.6.0, 2.7.0
>            Reporter: Alexey Miroshnichenko
>         Attachments: XsiType.diff
>
>
> input.xml
> =================
> <?xml version="1.0" encoding="UTF-8"?>
> <purchaseOrder xmlns="http://www.openuri.org/mySchema" 
>     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
>     xsi:schemaLocation="http://www.openuri.org/mySchema xsd.xsd">
> 	<shipTo>
> 		<name>ship-to-name</name>
> 		<element_of_any_type>
> 			<unknown_element xsi:type="USState">AK</unknown_element>
> 		</element_of_any_type>
> 	</shipTo>
> 	<billTo>
> 		<name>bill-to-name</name>
> 		<element_of_any_type/>
> 	</billTo>
> </purchaseOrder>
> =================
> xsd.xsd
> =================
> <?xml version="1.0"?>
> <xsd:schema xmlns="http://www.openuri.org/mySchema" 
>             elementFormDefault="qualified" 
>             targetNamespace="http://www.openuri.org/mySchema"
>             xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>             >
>   <xsd:element name="purchaseOrder" type="PurchaseOrderType" />
>   <xsd:complexType name="PurchaseOrderType">
>     <xsd:sequence>
>       <xsd:element name="shipTo" type="USAddress" />
>       <xsd:element name="billTo" type="USAddress" />
>     </xsd:sequence>
>   </xsd:complexType>
>   <xsd:complexType name="USAddress">
>     <xsd:sequence>
>       <xsd:element name="name" type="xsd:string" />
>       <xsd:element name="element_of_any_type"/>
>     </xsd:sequence>
> 	<!-- declaration of this attribute is necesary to reproduce -->
>     <xsd:attribute fixed="US" name="country" type="xsd:NMTOKEN" />
>   </xsd:complexType>
>   <xsd:simpleType name="USState">
> 	<xsd:restriction base="xsd:string">
> 		<xsd:enumeration value="AK"/>
> 		<xsd:enumeration value="AL"/>
> 	</xsd:restriction>
>   </xsd:simpleType>
> </xsd:schema>
> =================
> Validation of input.xml reports follow error:
> Error at file input.xml, line 11, char 10
>   Message: Type 'USState' that is used in xsi:type is not derived from the type of element 'billTo'
> reason for this behavior is that SchemaValidator::fXsiType is not cleared after element "unknown_element" processing.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org


[jira] Resolved: (XERCESC-1707) Processing of not-declared-element with "xsi:type" under anyType element does not clear SchemaValidator::fXsiType

Posted by "Alberto Massari (JIRA)" <xe...@xml.apache.org>.
     [ https://issues.apache.org/jira/browse/XERCESC-1707?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alberto Massari resolved XERCESC-1707.
--------------------------------------

       Resolution: Fixed
    Fix Version/s: 3.1.0
         Assignee: Alberto Massari

A fix is in SVN

> Processing of not-declared-element with "xsi:type" under anyType element does not clear SchemaValidator::fXsiType
> -----------------------------------------------------------------------------------------------------------------
>
>                 Key: XERCESC-1707
>                 URL: https://issues.apache.org/jira/browse/XERCESC-1707
>             Project: Xerces-C++
>          Issue Type: Bug
>          Components: Validating Parser (XML Schema)
>    Affects Versions: 2.6.0, 2.7.0
>            Reporter: Alexey Miroshnichenko
>            Assignee: Alberto Massari
>             Fix For: 3.1.0
>
>         Attachments: XsiType.diff
>
>
> input.xml
> =================
> <?xml version="1.0" encoding="UTF-8"?>
> <purchaseOrder xmlns="http://www.openuri.org/mySchema" 
>     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
>     xsi:schemaLocation="http://www.openuri.org/mySchema xsd.xsd">
> 	<shipTo>
> 		<name>ship-to-name</name>
> 		<element_of_any_type>
> 			<unknown_element xsi:type="USState">AK</unknown_element>
> 		</element_of_any_type>
> 	</shipTo>
> 	<billTo>
> 		<name>bill-to-name</name>
> 		<element_of_any_type/>
> 	</billTo>
> </purchaseOrder>
> =================
> xsd.xsd
> =================
> <?xml version="1.0"?>
> <xsd:schema xmlns="http://www.openuri.org/mySchema" 
>             elementFormDefault="qualified" 
>             targetNamespace="http://www.openuri.org/mySchema"
>             xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>             >
>   <xsd:element name="purchaseOrder" type="PurchaseOrderType" />
>   <xsd:complexType name="PurchaseOrderType">
>     <xsd:sequence>
>       <xsd:element name="shipTo" type="USAddress" />
>       <xsd:element name="billTo" type="USAddress" />
>     </xsd:sequence>
>   </xsd:complexType>
>   <xsd:complexType name="USAddress">
>     <xsd:sequence>
>       <xsd:element name="name" type="xsd:string" />
>       <xsd:element name="element_of_any_type"/>
>     </xsd:sequence>
> 	<!-- declaration of this attribute is necesary to reproduce -->
>     <xsd:attribute fixed="US" name="country" type="xsd:NMTOKEN" />
>   </xsd:complexType>
>   <xsd:simpleType name="USState">
> 	<xsd:restriction base="xsd:string">
> 		<xsd:enumeration value="AK"/>
> 		<xsd:enumeration value="AL"/>
> 	</xsd:restriction>
>   </xsd:simpleType>
> </xsd:schema>
> =================
> Validation of input.xml reports follow error:
> Error at file input.xml, line 11, char 10
>   Message: Type 'USState' that is used in xsi:type is not derived from the type of element 'billTo'
> reason for this behavior is that SchemaValidator::fXsiType is not cleared after element "unknown_element" processing.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org