Page last modified 12:48, 2 Apr 2014 by juhako

cvc-elt-4-3

     

    Notice! This page describes the nature of the error using a hypothetical example and not the erroneous data of the input test file. You should however be able to apply this information to your error case.

    General description of the error:

    The format of the error message: cvc-elt.4.3: Type ''{1}'' is not validly derived from the type definition, ''{2}'', of element ''{0}''.

    Error description in schema standard: http://www.w3.org/TR/2007/WD-xmlschema11-1-20070830/#cvc-elt

    Possible causes for this error:

    • File has an element with a type that is not extended (derived) from the base datatype.
    An example
    Schema would be along with:

    <xsd:element name="directory">
      <xsd:complexType>
         <xsd:sequence>
            <xsd:element name="contact" type="contactType" minOccurs="0" maxOccurs="unbounded"/>
         </xsd:sequence>
       </xsd:complexType>
    </xsd:element>
    <!-- Defining the base datatype -->
    <xsd:complexType name="contactType">
      <xsd:sequence>
         <xsd:element name="name" type="xsd:string"/>
      </xsd:sequence>
    </xsd:complexType>
    <!-- Defining a derived datatype -->
    <xsd:complexType name="emailContactType">
       <xsd:complexContent>
            <xsd:extension base="contactType">
                <xsd:sequence>
                    <xsd:element name="email" type="xsd:string"/>
                </xsd:sequence>
            </xsd:extension>
       </xsd:complexContent>
    </xsd:complexType>

    Valid file would be:
    <directory xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
        <contact xsi:type="emailContactType">
            <email>email@server.com</email>
        </contact>
    </directory>

     

     

     

     

     

    In this case the 'webContactType' is not defined as extension of contactType  like in the emailContactType in the valid example.

    <directory xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
        <contact xsi:type="webContactType">
            <email>email@server.com</email>
        </contact>
    </directory>

     

     

     

     

     

    Error message: Error cvc-elt.4.3: Type 'webContactType' is not validly derived from the type definition, 'contactType', of element 'contact'.

    How to fix: The error can be corrected by looking up the schema and checking what elements can be used. Usable elements are those that are derived from base datatype with:

    <xsd:extension base="contactType">

    Menu