The exception you saw is not related to type extension, in you elementManager.xsd:

<complexType name="VersionType">
 <element ref="variable" minOccurs="0"/>
 <attribute name="number" type="string"/>
</complexType>
 
 <complexType name="VariableType" >      
 <attribute name="name" type="string"/>
</complexType>
 
<complexType name="SimpleVariableType" base="VariableType"
 derivedBy="extension">
</complexType>
1. You may want to use content="textOnly" or "elementOnly" to disambiguite the contentType of the complexTypes you want to define.  I don't mean this is required by the Schema spec working draft. but for the current implementation, it is better to make the schema definition more "clear".  We will make the parser conform to whatever is the finalized defaulting behavior in the coming Schema standard.
 
2. even if you tried the fixes mentioned in 1., you probably will still see another error message. In this case, it is because, "SimpleVariableType" can NOT extend a complexType "Variable" with simpleType content, to make it valid, change derivedBy="extension" to derivedBy="restriction".
 
 
 
 
_____
 

Eric Ye * IBM, JTC - Silicon Valley * [EMAIL PROTECTED]

> Steve Buroff wrote:

>

> I've attached small xml and xsd files that blow away xerces 1.1.1 with

> the exception below. I believe it is caused by the extended type declaration.

>

> Steve Buroff

>

>

> org.apache.xerces.validators.common.CMException

>

> at org.apache.xerces.validators.common.Grammar.createChildModel(Grammar.java:509)

>

> at org.apache.xerces.validators.common.Grammar.getElementContentModel(Grammar.java:262)

>

> at

> org.apache.xerces.validators.common.XMLValidator.getElementContentModel(XMLValidator.java:1593)

>

> at

> org.apache.xerces.validators.common.XMLValidator.getContentModel(XMLValidator.java:1283)

>

> at org.apache.xerces.validators.common.XMLValidator.checkContent(XMLValidator.java:2613)

>

> at

> org.apache.xerces.validators.common.XMLValidator.callEndElement(XMLValidator.java:814)

>

> at

> org.apache.xerces.framework.XMLDocumentScanner.scanElement(XMLDocumentScanner.java:1855)

>

> at

> org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch(XMLDocumentScanner.java:1233)

>

> at org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner.java:380)

>

> at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:817)

>

> at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:856)

>

> at sax.SAXCount.print(SAXCount.java:135)

>

> at sax.SAXCount.main(SAXCount.java:331)

>

> java.lang.NullPointerException

>

> at org.apache.xerces.validators.common.XMLValidator.checkContent(XMLValidator.java:2614)

>

> at

> org.apache.xerces.validators.common.XMLValidator.callEndElement(XMLValidator.java:814)

>

> at

> org.apache.xerces.framework.XMLDocumentScanner.scanElement(XMLDocumentScanner.java:1855)

>

> at

> org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch(XMLDocumentScanner.java:1233)

>

> at org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner.java:380)

>

> at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:817)

>

> at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:856)

>

> at sax.SAXCount.print(SAXCount.java:135)

>

> at sax.SAXCount.main(SAXCount.java:331)

>

> Process Exit...

>

> Name: elementManager.xsd

> elementManager.xsd Type: unspecified type (application/octet-stream)

> Encoding: 7bit

>

> Name: elementManager.xml

> elementManager.xml Type: XML Document (text/xml)

> Encoding: 7bit

>

Reply via email to