cvc-elt.4.3: Type 'ns0:localComplexType' is not validly derived from the type 
definition, 'complexType', of element 'value'.
----------------------------------------------------------------------------------------------------------------------------

                 Key: XERCESJ-1467
                 URL: https://issues.apache.org/jira/browse/XERCESJ-1467
             Project: Xerces2-J
          Issue Type: Bug
          Components: XML Schema 1.0 Structures
    Affects Versions: 2.10.0
         Environment: Xerces2-J 2.10.0
            Reporter: David Green-Lank


Given the schema (dgreen.xsd):

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";>
  <xs:import namespace="http://www.w3.org/2001/XMLSchema"; 
schemaLocation="XMLSchema.xsd"/>
  <xs:element name="eComplexType">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="value" minOccurs="0" type="xs:complexType"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>

Parsing the instance document (dgreen.xml):

<?xml version="1.0"?>
<eComplexType>
  <value name="foo" xsi:type="ns0:localComplexType" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xmlns:ns0="http://www.w3.org/2001/XMLSchema"/>
</eComplexType>

Code to reproduce (Main.java):

import org.apache.xerces.jaxp.validation.XMLSchemaFactory;
import javax.xml.validation.Schema;
import javax.xml.validation.Validator;
import javax.xml.transform.stream.StreamSource;
import java.io.File;
public class Main {
  public static void main( String... args ) throws Exception {
    XMLSchemaFactory schemaFactory = new XMLSchemaFactory();
    Schema schema = schemaFactory.newSchema( new File( "dgreen.xsd" ) );
    Validator validator = schema.newValidator();
    validator.validate( new StreamSource( new File( "dgreen.xml" ) ) );
  }
}

Produces the following:

Exception in thread "main" org.xml.sax.SAXParseException: cvc-elt.4.3: Type 
'ns0:localComplexType' is not validly derived from the type definition, 
'complexType', of element 'value'.
        at 
org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown 
Source)
        at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source)
        at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
        at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
        at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
        at 
org.apache.xerces.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(Unknown
 Source)
        at 
org.apache.xerces.impl.xs.XMLSchemaValidator.reportSchemaError(Unknown Source)
        at 
org.apache.xerces.impl.xs.XMLSchemaValidator.getAndCheckXsiType(Unknown Source)
        at 
org.apache.xerces.impl.xs.XMLSchemaValidator.handleStartElement(Unknown Source)
        at org.apache.xerces.impl.xs.XMLSchemaValidator.emptyElement(Unknown 
Source)
        at 
org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
        at 
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown
 Source)
        at 
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown 
Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at 
org.apache.xerces.jaxp.validation.StreamValidatorHelper.validate(Unknown Source)
        at org.apache.xerces.jaxp.validation.ValidatorImpl.validate(Unknown 
Source)
        at javax.xml.validation.Validator.validate(Validator.java:127)
        at Main.main(Main.java:11)

I believe that localComplexType is validly derived from complexType, or am I 
missing something? I apologize in advance if I filed this bug in error.

-- 
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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to