G
GeezerButler
I am really sorry if this sounds stupid. Namespace is just not my cup
of tea.
Could anybody tell me what is wrong with this xsd file (It has
something wrong with the namespaces)
I am getting the error "The element 'Books' is used but not declared in
the DTD/Schema."
If I remove targetNamespace="http://calendar/aiman" and
xmlns:myns="http://calendar/aiman" and change type="myns:BookType" to
type="BookType" it works.
-------------------------------------------------
<?xml version="1.0"?>
<xsd:schema
targetNamespace="http://calendar/aiman"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:myns="http://calendar/aiman"
elementFormDefault="qualified">
<xsd:element name="Books">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Book" type="myns:BookType" minOccurs="1"
maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:complexType name="BookType">
<xsd:sequence>
<xsd:element name="Name" type="xsd:string" minOccurs="1"/>
<xsd:element name="Author" type="xsd:string" minOccurs="1"/>
<xsd:element name="Award" type="xsd:string" minOccurs="0"/>
<xsd:element name="Price" minOccurs="1">
<xsd:simpleType>
<xsd:restriction base="xsd:integer">
<xsd:minInclusive value="0"/>
<xsd:maxInclusive value="5000"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="Description" minOccurs="0" maxOccurs="1">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="50"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
</xsd:sequence>
<xsd:attribute name="id" type="xsd:integer" use="required"/>
</xsd:complexType>
</xsd:schema>
of tea.
Could anybody tell me what is wrong with this xsd file (It has
something wrong with the namespaces)
I am getting the error "The element 'Books' is used but not declared in
the DTD/Schema."
If I remove targetNamespace="http://calendar/aiman" and
xmlns:myns="http://calendar/aiman" and change type="myns:BookType" to
type="BookType" it works.
-------------------------------------------------
<?xml version="1.0"?>
<xsd:schema
targetNamespace="http://calendar/aiman"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:myns="http://calendar/aiman"
elementFormDefault="qualified">
<xsd:element name="Books">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Book" type="myns:BookType" minOccurs="1"
maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:complexType name="BookType">
<xsd:sequence>
<xsd:element name="Name" type="xsd:string" minOccurs="1"/>
<xsd:element name="Author" type="xsd:string" minOccurs="1"/>
<xsd:element name="Award" type="xsd:string" minOccurs="0"/>
<xsd:element name="Price" minOccurs="1">
<xsd:simpleType>
<xsd:restriction base="xsd:integer">
<xsd:minInclusive value="0"/>
<xsd:maxInclusive value="5000"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="Description" minOccurs="0" maxOccurs="1">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="50"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
</xsd:sequence>
<xsd:attribute name="id" type="xsd:integer" use="required"/>
</xsd:complexType>
</xsd:schema>