You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by Fabio Riccardi <fa...@xqrl.com> on 2002/05/26 02:38:22 UTC

Bug in PSVI MemberType?

Dear all,

I think that I have found a bug in the MemberType implementation of the 
PSVI.

In the example listed at the end of this message I would expect the 
content of the element(s) "judgement" to be validated either to "s1:grade"
  or to "xsi:string", according to the match (for readability I've 
substituted the prefix for the uri).

Instead I find something like "s1:null", which (I think) corresponds to 
the rather uninteresting anonymous simpleType element outside of the 
restriction. The definition in the Schema:Structures document for [member 
type definition] is:

> If and only if that type definition is a simple type definition with 
> {variety} union, or a complex type definition whose {content type} is a 
> simple thype definition with {variety} union, then an ·item isomorphic· 
> to that member of the union's {member type definitions} which actually ·v
> alidated· the element item's ·normalized value·.

which I have come to believe it says "give me the base type of the 
restriction", rather than some uninteresting anySimpleType, right?

If my analysis is true then a possible fix would be to turn the line:

	fCurrentPSVI.fMemberType = fValidatedInfo.memberType;

of XMLSchemaValidator.elementLocallyValidType into:

	fCurrentPSVI.fMemberType = fValidatedInfo.memberType.base;

Cheers,

  - Fabio

--- file: union.xsd. ---

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd='http://www.w3.org/2001/XMLSchema'
     xmlns:s1="http://www.xqrl.com/union"
     targetNamespace="http://www.xqrl.com/union"
     elementFormDefault="qualified" >

     <xsd:complexType name="rootType">
         <xsd:sequence>
             <xsd:element name="judgement" type="s1:grade" minOccurs="1" 
maxOccurs="5">
             </xsd:element>
         </xsd:sequence>
     </xsd:complexType>

     <xsd:simpleType name="mark">
         <xsd:restriction base="xsd:integer">
             <xsd:enumeration value="1"/>
             <xsd:enumeration value="2"/>
             <xsd:enumeration value="3"/>
         </xsd:restriction>
     </xsd:simpleType>

     <xsd:simpleType name="grade">
         <xsd:union>
             <xsd:simpleType>
                 <xsd:restriction base="s1:mark"/>
             </xsd:simpleType>
             <xsd:simpleType>
                 <xsd:restriction base="xsd:string"/>
             </xsd:simpleType>
         </xsd:union>
     </xsd:simpleType>

     <xsd:element name="root" type="s1:rootType"/>

</xsd:schema>

--- file: union.xml ---

<s1:root xmlns:s1="http://www.xqrl.com/union"
	     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  		 xsi:schemaLocation="http://www.xqrl.com/union 
tests/schema/union.xsd" >

     <s1:judgement>1</s1:judgement>
     <s1:judgement>2</s1:judgement>
     <s1:judgement>cheesy!</s1:judgement>
</s1:root>

--- end ---


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