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 bu...@apache.org on 2003/02/21 23:10:07 UTC

DO NOT REPLY [Bug 17304] New: - Constraints on XML Rep. of Complex Type

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=17304>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=17304

Constraints on XML Rep. of Complex Type

           Summary: Constraints on XML Rep. of Complex Type
           Product: Xerces2-J
           Version: 2.3.0
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: XML Schema Structures
        AssignedTo: xerces-j-dev@xml.apache.org
        ReportedBy: nmehrega@ca.ibm.com
                CC: nddelima@ca.ibm.com


According to section 3.4.3 of the schema-structures specs:

"In addition to the conditions imposed on <complexType> element information
items          by the schema for schemas, all of the following must be true:
    1 If the <complexContent> alternative is chosen, the type definition
      �resolved� to by the �actual value� of the base [attribute] must be a
      complex type definition;
 
    2 If the <simpleContent> alternative is chosen, all of the following must
      be true:
      2.1 The type definition �resolved� to by the �actual value� of the base
          [attribute] must be one of the following:
        
          2.1.1 a complex type definition whose {content type} is a simple type
                definition;
          2.1.2
                &#8593;only if the <restriction> alternative is also chosen, a complex
                type definition whose {content type} is mixed and a particle
                which is �emptiable�, as defined in Particle Emptiable(�3.9.6);&#8593;
          2.1.3 only if the <extension> alternative is also chosen, a
                simple type definition."

Now cosider the following schema code:

<?xml version="1.0"?>

<schema xmlns          ="http://www.w3.org/2001/XMLSchema"
        targetNamespace="http://www.schemaTest.org/IBM3_4v34"
        xmlns:v34  ="http://www.schemaTest.org/IBM3_4v34">

<complexType name="base" mixed="true">
	<sequence>
		<element name="bbb" minOccurs="0" maxOccurs="0">
			<simpleType>
				<restriction base="float"/>
			</simpleType>
		</element>
	</sequence>
</complexType>

<complexType name="derived">
	<simpleContent>
		<restriction base="v34:base">
			<simpleType>
				<restriction base="float"/>
			</simpleType>
		</restriction>
	</simpleContent>	
</complexType>

<element name="root" type="anyType"/>

</schema>

This is a valid schema file, but the parser generates the following error:
	    
	  "[Error] ibm3_4v33.xsd:25:30: src-ct.2: Complex Type Definition
           Representation Error for type 'derived'.  When simpleContent is used,
           the base type must be a complexType whose content type is simple, or,
           only if extension is specified, a simple type."


Clause (2.1.2) applies to this test case where the element declared in the base 
type is emptiable, and hence the schema is valid.

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