XSD problem
-
I've created the following XML Schema (not for production use, but to learn by doing). Here's what is burning me at the moment: The xs:element elements that refer to classes or properties are giving me warnings that "Type 'class' is not declared". I'm still learning this stuff, so I'd really appreciate it if someone could take a quick peek at it and advise me of the (probably obvious) problem in the code below. Thanks, Will
<?xml version="1.0" encoding="utf-8"?>
<xs:schema targetNamespace="http://gantsoftwaresystems.com/classspec.xsd"
elementFormDefault="qualified"
xmlns:xs="http://www.w3.org/2001/XMLSchema"<xs:element name="classDefs"> <xs:complexType> <xs:sequence minOccurs="1" maxOccurs="unbounded"> <xs:element name="classes"> <xs:complexType> <xs:sequence minOccurs="1" maxOccurs="unbounded"> <xs:element name="class" type="class"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="views"> <xs:complexType> <xs:sequence> <xs:element name="view" type="class"/> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> <xs:complexType name="class"> <xs:sequence minOccurs="1" maxOccurs="unbounded"> <xs:element name="property" type="property"/> </xs:sequence> <xs:attribute name="name" type="xs:string"/> <xs:attribute name="base" type="xs:string"/> <xs:attribute name="hasImageUrl" type="xs:boolean"/> </xs:complexType> <xs:complexType name="property"> <xs:sequence minOccurs="0" maxOccurs="unbounded"> <xs:element name="alsoTriggerPropertyChanged"> <xs:complexType> <xs:attribute name="propertyName" type="xs:string"/> </xs:complexType> </xs:element> </xs:sequence> <xs:attribute name="name" type="xs:string"/> <xs:attribute name="type" type="xs:string"/> <xs:attribute name="changesImageUrl" type="xs:boolean"/> <xs:attribute name="imageUrlQStringParamName" type="xs:string"/> <xs:attribute name="imageUrlOverridePropertyName" type="xs:string"/> </xs:complexType>
</xs:schema>
-
I've created the following XML Schema (not for production use, but to learn by doing). Here's what is burning me at the moment: The xs:element elements that refer to classes or properties are giving me warnings that "Type 'class' is not declared". I'm still learning this stuff, so I'd really appreciate it if someone could take a quick peek at it and advise me of the (probably obvious) problem in the code below. Thanks, Will
<?xml version="1.0" encoding="utf-8"?>
<xs:schema targetNamespace="http://gantsoftwaresystems.com/classspec.xsd"
elementFormDefault="qualified"
xmlns:xs="http://www.w3.org/2001/XMLSchema"<xs:element name="classDefs"> <xs:complexType> <xs:sequence minOccurs="1" maxOccurs="unbounded"> <xs:element name="classes"> <xs:complexType> <xs:sequence minOccurs="1" maxOccurs="unbounded"> <xs:element name="class" type="class"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="views"> <xs:complexType> <xs:sequence> <xs:element name="view" type="class"/> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> <xs:complexType name="class"> <xs:sequence minOccurs="1" maxOccurs="unbounded"> <xs:element name="property" type="property"/> </xs:sequence> <xs:attribute name="name" type="xs:string"/> <xs:attribute name="base" type="xs:string"/> <xs:attribute name="hasImageUrl" type="xs:boolean"/> </xs:complexType> <xs:complexType name="property"> <xs:sequence minOccurs="0" maxOccurs="unbounded"> <xs:element name="alsoTriggerPropertyChanged"> <xs:complexType> <xs:attribute name="propertyName" type="xs:string"/> </xs:complexType> </xs:element> </xs:sequence> <xs:attribute name="name" type="xs:string"/> <xs:attribute name="type" type="xs:string"/> <xs:attribute name="changesImageUrl" type="xs:boolean"/> <xs:attribute name="imageUrlQStringParamName" type="xs:string"/> <xs:attribute name="imageUrlOverridePropertyName" type="xs:string"/> </xs:complexType>
</xs:schema>
You need to namespace qualify the type references - you declare them in your target namespace, but when you reference them, don't mention that namespace. You can either use explicit namespace references or (and this is easier) use your target namespace as the default namespace for the schema.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p