<?xml version="1.0" encoding="UTF-8"?>
<!-- $Header: /home/cvsroot/w3c-xml-schema/user/examples/first-user-dt.xsd,v 1.1 2001/11/01 12:27:47 vdv Exp $ -->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

	<xs:simpleType name="string255">
		<xs:restriction base="xs:token">
			<xs:maxLength value="255"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="string32">
		<xs:restriction base="xs:token">
			<xs:maxLength value="32"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="isbn">
		<xs:restriction base="xs:unsignedLong">
			<xs:totalDigits value="10"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="supportedLanguages">
		<xs:restriction base="xs:language">
			<xs:enumeration value="en"/>
			<xs:enumeration value="es"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:element name="name" type="string32"/>
	<xs:element name="qualification" type="string255"/>
	<xs:element name="born" type="xs:date"/>
	<xs:element name="dead" type="xs:date"/>
	<xs:element name="isbn" type="isbn"/>
	
	<xs:attribute name="id" type="xs:ID"/>
	<xs:attribute name="available" type="xs:boolean"/>
	<xs:attribute name="lang" type="supportedLanguages"/>
	
	<xs:element name="title">
		<xs:complexType>
			<xs:simpleContent>
				<xs:extension base="string255">
					<xs:attribute ref="lang"/>
				</xs:extension>
			</xs:simpleContent>
		</xs:complexType>
	</xs:element>
	
	<xs:element name="library">
		<xs:complexType>
			<xs:sequence>
				<xs:element ref="book" maxOccurs="unbounded"/>
			</xs:sequence>
		</xs:complexType>
	</xs:element>
	
	<xs:element name="author">
		<xs:complexType>
			<xs:sequence>
				<xs:element ref="name"/>
				<xs:element ref="born"/>
				<xs:element ref="dead" minOccurs="0"/>
			</xs:sequence>
			<xs:attribute ref="id"/>
		</xs:complexType>
	</xs:element>
	
	<xs:element name="book">
		<xs:complexType>
			<xs:sequence>
				<xs:element ref="isbn"/>
				<xs:element ref="title"/>
				<xs:element ref="author" minOccurs="0" maxOccurs="unbounded"/>
				<xs:element ref="character" minOccurs="0" maxOccurs="unbounded"/>
			</xs:sequence>
			<xs:attribute ref="id"/>
			<xs:attribute ref="available"/>
		</xs:complexType>
	</xs:element>
	
	<xs:element name="character">
		<xs:complexType>
			<xs:sequence>
				<xs:element ref="name"/>
				<xs:element ref="born"/>
				<xs:element ref="qualification"/>
			</xs:sequence>
			<xs:attribute ref="id"/>
		</xs:complexType>
	</xs:element>
	
</xs:schema>