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

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   misunderstanding of XML Schema ?

[ Lists Home | Date Index | Thread Index ]

Trying to define a base type of PropertyType,

And derived several types from this base type. Where the name element is restricted to a fix list in each derived type.

 

Have a file that should have a list of these derived types in a specific order.

 

In XML spy when I try to validate the file it complains that the second Property entry does not have DisplayName, when it has a Type.

 

Why does it think all Property entires are DisplayPropertyType's ??

 

XML File

 

<ComponentRegistry>

  <Components>

    <Component name="DB Reader">

      <ShowOnDemand>true</ShowOnDemand>

      <Description>

       Reads data from a database whose data model is supported by an ObjectServer

       </Description>

      <Property>

        <Constant>true</Constant>

        <Name>DisplayName</Name>

        <Value>DB Readerr</Value>

      </Property>

      <Property>

        <Constant>true</Constant>

        <Name>Type</Name>

        <Value>ObjectServer Reader</Value>

      </Property>

      <Property>

        <Constant>true</Constant>

        <Name>Class</Name>

        <Value>com.lgc.im.dataio.db.objectserver.ReaderImpl</Value>

      </Property>

      <Property>

        <Constant>true</Constant>

        <Name>Category</Name>

        <Value>DataBase</Value>

      </Property>

      <Property>

        <Constant>true</Constant>

        <Name>Format</Name>

        <Value>ObjectServer</Value>

      </Property>

      <Property>

        <Constant>true</Constant>

        <Name>Resource Class</Name>

        <Value>com.lgc.im.dataio.db.objectserver.ResourceImpl</Value>

      </Property>

     

    </Component>

  </Components>

</ComponentRegistry>

 

 

<?xml version="1.0" encoding="UTF-8"?>

<!-- edited with XMLSPY v5 rel. 2 U (http://www.xmlspy.com) by James L. Blunt (Landmark Graphics Corp.) -->

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">

  <xs:element name="ComponentRegistry">

    <xs:annotation>

      <xs:documentation>Comment describing your root element</xs:documentation>

    </xs:annotation>

    <xs:complexType>

      <xs:sequence>

        <xs:element name="Components">

          <xs:complexType>

            <xs:sequence minOccurs="0" maxOccurs="unbounded">

              <xs:element name="Component">

                <xs:complexType>

                  <xs:sequence>

                    <xs:element name="ShowOnDemand" type="xs:boolean"/>

                    <xs:element name="Description" type="xs:string"/>

                    <xs:element name="Property" type="DisplayPropertyType"/>

                    <xs:element name="Property" type="TypePropertyType"/>

                    <xs:element name="Property" type="ClassPropertyType"/>

                    <xs:element name="Property" type="CategoryPropertyType"/>

                    <xs:element name="Property" type="FormatPropertyType"/>

                    <xs:element name="Property" type="ResourceClassPropertyType"/>

                  </xs:sequence>

                  <xs:attribute name="name" type="xs:string" use="required"/>

                </xs:complexType>

              </xs:element>

            </xs:sequence>

          </xs:complexType>

        </xs:element>

      </xs:sequence>

    </xs:complexType>

  </xs:element>

  <xs:complexType name="PropertyType">

    <xs:sequence>

      <xs:element name="Constant" type="xs:boolean" minOccurs="0"/>

      <xs:element name="Name" type="xs:string"/>

      <xs:element name="Value" type="xs:string"/>

      <xs:element name="InVisible" type="xs:boolean" minOccurs="0"/>

    </xs:sequence>

  </xs:complexType>

  <xs:complexType name="DisplayPropertyType">

    <xs:complexContent>

      <xs:restriction base="PropertyType">

        <xs:sequence>

          <xs:element name="Constant" type="xs:boolean" minOccurs="0"/>

          <xs:element name="Name">

            <xs:simpleType>

              <xs:restriction base="xs:string">

                <xs:enumeration value="DisplayName"/>

              </xs:restriction>

            </xs:simpleType>

          </xs:element>

          <xs:element name="Value" type="xs:string"/>

          <xs:element name="InVisible" type="xs:boolean" minOccurs="0"/>

        </xs:sequence>

      </xs:restriction>

    </xs:complexContent>

  </xs:complexType>

  <xs:complexType name="TypePropertyType">

    <xs:complexContent>

      <xs:restriction base="PropertyType">

        <xs:sequence>

          <xs:element name="Constant" type="xs:boolean" minOccurs="0"/>

          <xs:element name="Name">

            <xs:simpleType>

              <xs:restriction base="xs:string">

                <xs:enumeration value="Type"/>

              </xs:restriction>

            </xs:simpleType>

          </xs:element>

          <xs:element name="Value" type="xs:string"/>

          <xs:element name="InVisible" type="xs:boolean" minOccurs="0"/>

        </xs:sequence>

      </xs:restriction>

    </xs:complexContent>

  </xs:complexType>

  <xs:complexType name="ClassPropertyType">

    <xs:complexContent>

      <xs:restriction base="PropertyType">

        <xs:sequence>

          <xs:element name="Constant" type="xs:boolean" minOccurs="0"/>

          <xs:element name="Name">

            <xs:simpleType>

              <xs:restriction base="xs:string">

                <xs:enumeration value="Class"/>

              </xs:restriction>

            </xs:simpleType>

          </xs:element>

          <xs:element name="Value" type="xs:string"/>

          <xs:element name="InVisible" type="xs:boolean" minOccurs="0"/>

        </xs:sequence>

      </xs:restriction>

    </xs:complexContent>

  </xs:complexType>

  <xs:complexType name="CategoryPropertyType">

    <xs:complexContent>

      <xs:restriction base="PropertyType">

        <xs:sequence>

          <xs:element name="Constant" type="xs:boolean" minOccurs="0"/>

          <xs:element name="Name">

            <xs:simpleType>

              <xs:restriction base="xs:string">

                <xs:enumeration value="Category"/>

              </xs:restriction>

            </xs:simpleType>

          </xs:element>

          <xs:element name="Value" type="xs:string"/>

          <xs:element name="InVisible" type="xs:boolean" minOccurs="0"/>

        </xs:sequence>

      </xs:restriction>

    </xs:complexContent>

  </xs:complexType>

  <xs:complexType name="FormatPropertyType">

    <xs:complexContent>

      <xs:restriction base="PropertyType">

        <xs:sequence>

          <xs:element name="Constant" type="xs:boolean" minOccurs="0"/>

          <xs:element name="Name">

            <xs:simpleType>

              <xs:restriction base="xs:string">

                <xs:enumeration value="Format"/>

              </xs:restriction>

            </xs:simpleType>

          </xs:element>

          <xs:element name="Value" type="xs:string"/>

          <xs:element name="InVisible" type="xs:boolean" minOccurs="0"/>

        </xs:sequence>

      </xs:restriction>

    </xs:complexContent>

  </xs:complexType>

  <xs:complexType name="ResourceClassPropertyType">

    <xs:complexContent>

      <xs:restriction base="PropertyType">

        <xs:sequence>

          <xs:element name="Constant" type="xs:boolean" minOccurs="0"/>

          <xs:element name="Name">

            <xs:simpleType>

              <xs:restriction base="xs:string">

                <xs:enumeration value="Resource Class"/>

              </xs:restriction>

            </xs:simpleType>

          </xs:element>

          <xs:element name="Value" type="xs:string"/>

          <xs:element name="InVisible" type="xs:boolean" minOccurs="0"/>

        </xs:sequence>

      </xs:restriction>

    </xs:complexContent>

  </xs:complexType>

</xs:schema>

 

 

 

 

Bill Riegel

LandMark Graphics

713-839-3388

 





 

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

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