hello guys, I need some help here 
The question:
Write an XML Schema equivalent to the following XML DTD (note:
xmlns:xsd="http://www.w3.org/2001/XMLSchema"):
My answer:
is it correct?
cheers

The question:
Write an XML Schema equivalent to the following XML DTD (note:
xmlns:xsd="http://www.w3.org/2001/XMLSchema"):
Code:
<!ELEMENT book (title, chapter+)>
<!ATTLIST book
type (fiction | non-fiction) #REQUIRED>
<!ELEMENT chapter (title, paragraph+)>
<!ELEMENT title (#PCDATA)>
<!ELEMENT paragraph (#PCDATA)>
My answer:
Code:
<?xml version ="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.books.org"
xmlns="http://www.books.org"
elementFormDefault="qualified">
<xsd:element name="book">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="title" minOccurs="1" maxOccurs="1"/>
<xsd:element ref="chapter" minOccurs="1" maxOccurs="unbounded"/>
</xsd:sequence>
<xsd:attribute name="type" use="required">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:enumeration value="fiction"/>
<xsd:enumeration value="non-fiction"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:attribute>
</xsd:complexType>
</xsd:element>
<xsd:element name="chapter">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="title" minOccurs="1" maxOccurs="1"/>
<xsd:element ref="paragraph" minOccurs="1" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="title" type="xsd:string"/>
<xsd:element name="paragraph" type="xsd:string"/>
</xsd:schema>
is it correct?
cheers

Last edited: