[
Lists Home |
Date Index |
Thread Index
]
Hi, everyone:
I made to schemas--reserved.xsd and book.xsd. I hope to combine
them together and I try to import reserved.xsd to book.xsd.
I put the reserved.xsd at the location:
http://www.hut.fi/~wezm.
--------------------------------------------------------------------------
But the errors message occured:
reserved.xsd:2:56: src-import.3.1: The namespace attribute
'http://www.hut.fi/~wezm' of an <import> element information item must be
identical to the targetNamespace attribute 'null' of the imported document.
[Error] book.xsd:68:57: src-resolve.4: Components from namespace
'http://www.hut.fi/~wezm/' are not referenceable from schema document
'file:///tmp/example/xml_1/book.xsd'.
---------------------------------------------------------------------------
book.xsd
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:rv="http://www.hut.fi/~wzhou"
targetNamespace="http://www.w3.org/2001/XMLSchem"
elementFormDefault="unqualified"
attributeFormDefault="unqualified">
<xs:import namespace="http://www.hut.fi/~wzhou"
schemaLocation="reserved.xsd"/>
<!-- definition of simple types -->
<xs:simpleType name="nameType">
<xs:restriction base="xs:string">
<xs:maxLength value="64"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="sinceType">
<xs:restriction base="xs:date"/>
</xs:simpleType>
<xs:simpleType name="descType">
<xs:restriction base="xs:string"/>
</xs:simpleType>
<xs:simpleType name="isbnType">
<xs:restriction base="xs:string">
<xs:pattern value="[0-9]{10}"/>
</xs:restriction>
</xs:simpleType>
<!-- definition of group-->
<xs:group name="mainBookElement">
<xs:sequence>
<xs:element name="title" type="nameType"/>
<xs:element name="author" type="nameType"/>
</xs:sequence>
</xs:group>
<!-- definition of complex type library -->
<xs:complexType name="library">
<xs:sequence>
<xs:element name="name" type="nameType"/>
<xs:element name="address" type="nameType"/>
<xs:element name="books" type="books" minOccurs="1"
maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<!-- definition of complex type books -->
<xs:complexType name="books">
<xs:sequence>
<xs:element name="book" type="bookType" minOccurs="1"
maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="number" type="xs:int" use="required"/>
</xs:complexType>
<!-- definition of complex types -->
<xs:complexType name="characterType">
<xs:sequence>
<xs:element name="publicationDate" type="sinceType"/>
<xs:element name="description" type="descType"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="bookType">
<xs:sequence>
<xs:group ref="mainBookElement"/>
<xs:element name="character" type="characterType" minOccurs="1"
maxOccurs="unbounded"/>
<!-- the definition of the "character" element is using the
"characterType" complex type -->
------------------------------------------------------------------------
| <xs:element name="customer" type="rv:customerType"/> |
------------------------------------------------------------------------
</xs:sequence>
<xs:attribute name="isbn" type="isbnType" use="required"/>
</xs:complexType>
<xs:element name="library" type="library">
<xs:unique name="bookNumber">
<xs:selector xpath="bookType"/>
<xs:field xpath="@isbn"/>
</xs:unique>
<!--define a key construct-->
<xs:key name="charName">
<xs:selector xpath="bookType/mainBookElement"/>
<xs:field xpath="name"/>
</xs:key>
<!--define a keyref construct-->
<xs:keyref name="charNameRef" refer ="charName">
<xs:selector xpath="bookType"/>
<xs:field xpath="@isbn"/>
</xs:keyref>
</xs:element>
</xs:schema>
-----------------------------------------------------------------------
reserved.xsd
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- definition of simple types -->
<xs:simpleType name="nameType">
<xs:restriction base="xs:string">
<xs:maxLength value="32"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="cardType">
<xs:restriction base="xs:string">
<xs:pattern value="[0-9]{10}"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="DateType">
<xs:restriction base="xs:date"/>
</xs:simpleType>
<xs:complexType name="customerType">
<xs:sequence>
<xs:element name="title" type="nameType"/>
<xs:element name="cardNo." type="cardType"/>
<xs:element name="dueTime" type="dateType"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
_________________________________________________________________
Protect your PC - get McAfee.com VirusScan Online
http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
|