OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   question about restrictions

[ Lists Home | Date Index | Thread Index ]

I have a question regarding the following schema:

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema targetNamespace="urn:example" xmlns="urn:example"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"; elementFormDefault="qualified"
attributeFormDefault="unqualified">

  <xsd:element name="Root" type="RestrictedType"/>

  <xsd:complexType name="RestrictedType">
    <xsd:complexContent>
      <xsd:restriction base="BaseType">
        <xsd:sequence>
          <xsd:element name="FirstElement">
            <xsd:complexType>
              <xsd:choice>
                <xsd:element name="FirstChoice" type="xsd:string"
maxOccurs="unbounded"/>
                <xsd:element name="SecondChoice" type="xsd:string"
maxOccurs="unbounded"/>
              </xsd:choice>
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="SecondElement" type="xsd:string" minOccurs="0"
maxOccurs="unbounded"/>
        </xsd:sequence>
      </xsd:restriction>
    </xsd:complexContent>
  </xsd:complexType>

  <xsd:complexType name="BaseType">
    <xsd:sequence>
      <xsd:element name="FirstElement">
        <xsd:complexType>
          <xsd:choice>
            <xsd:element name="FirstChoice" type="xsd:string"
maxOccurs="unbounded"/>
            <xsd:element name="SecondChoice" type="xsd:string"
maxOccurs="unbounded"/>
          </xsd:choice>
        </xsd:complexType>
      </xsd:element>
      <xsd:element name="SecondElement" type="xsd:string" minOccurs="0"
maxOccurs="unbounded"/>
    </xsd:sequence>
  </xsd:complexType>

</xsd:schema>

When I try validating a simple XML document using Xerces with full schema
checking enabled, I get the following error message:
Error for type 'RestrictedType'.  The particle of the type is not a valid
restriction of the particle of the base.

Through the process of elimination, I've determined the trouble lies in
FirstElement found in the two types.  I've looked at the schema contraints
at http://www.w3.org/TR/xmlschema-1/#derivation-ok-restriction that I
believe govern this issue.  With reading those and since, FirstElement is a
verbatium copy from BaseType to RestrictedType I've been unable to determine
the cause for the invalid restriction message.

Can someone give me some insight into the cause of the violation?

Thanks,

Brent Worden







 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS