[
https://issues.apache.org/jira/browse/XERCESJ-1652?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14229039#comment-14229039
]
Mukul Gandhi commented on XERCESJ-1652:
---------------------------------------
my reading of the XSD spec (XSD 1.1 is better worded, but I think the
underlying intent is same in both XSD 1.0 and 1.1 for the bug reported), says
that the implementation should not work as per the example you've cited from
the spec. I think the example you've cited from the spec is intuitive in
nature, and not a formal specification of constraint.
Here's another example which works fine with xerces-j and reports a valid XSD
outcome,
<X xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<size>1</size>
<size>large</size>
<size xsi:type='xsd:string'>1</size>
</X>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<xsd:element name='size'>
<xsd:simpleType>
<xsd:union memberTypes="xsd:integer xsd:string"/>
</xsd:simpleType>
</xsd:element>
<xsd:element name="X">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="size" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
This example demonstrates one case, how a simpleType validly derived example
should work in case of simpleType variety xsd:union.
> xsi:type in element of union datatype makes validation fail. Example from XML
> Schema spec fails.
> ------------------------------------------------------------------------------------------------
>
> Key: XERCESJ-1652
> URL: https://issues.apache.org/jira/browse/XERCESJ-1652
> Project: Xerces2-J
> Issue Type: Bug
> Components: JAXP (javax.xml.validation)
> Affects Versions: 2.10.0
> Environment: Java 7 x64, Linux Ubuntu 14.04 x64
> Reporter: Nikolay Pakulin
>
> XML Schema Part 2: Datatypes Second Edition, section 2.5.1.3 Union datatypes
> (http://www.w3.org/TR/xmlschema-2/#union-datatypes) specifies that xsi:type
> attribute may be used to tell the exact variant of a union type used in the
> instance element.
> There is an example on how to use xsi:type attribute. That example does not
> pass in xerces-j:
> cvc-elt.4.3: Type 'xsd:string' is not validly derived from the type
> definition, 'null', of element 'size'.
> The sample XSD and instance document are available from
> https://www.dropbox.com/s/th1v2ts88cxad8x/union_datatype_xsi_type.zip?dl=0
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]