[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

import and targetnamspace


src resolve.4
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


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.