[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: misunderstanding of XML Schema ?
This is because you have defined the Property element several times within the same schema, with a different datatype each time. XML Spy is complaining on the second Property element because it expects it to be of "DisplayPropertyType", but instead it is of "TypePropertyType". According to your XML instance, it appears that Property has the same content model on each occurrence. You should probably just declare the Property element once and use the "maxOccurs" facet on it, to make it repeatable. Hope that helps. Joe Chiusano Booz | Allen | Hamilton > Bill Riegel wrote: > > 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 > > > > --------------------------------------------------------------- > ----------------------------------------------------------------- > The xml-dev list is sponsored by XML.org <http://www.xml.org>, an > initiative of OASIS <http://www.oasis-open.org> > > The list archives are at http://lists.xml.org/archives/xml-dev/ > > To subscribe or unsubscribe from this list use the subscription > manager: <http://lists.xml.org/ob/adm.pl> begin:vcard n:Chiusano;Joseph tel;work:(703) 902-6923 x-mozilla-html:FALSE url:www.bah.com org:Booz | Allen | Hamilton;IT Digital Strategies Team adr:;;8283 Greensboro Drive;McLean;VA;22012; version:2.1 email;internet:chiusano_joseph@b... title:Senior Consultant fn:Joseph M. Chiusano end:vcard
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|