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

RE: help me on the method of import in the schema

From: Michael Kay <mike@saxonica.com>
Date: Wed, 18 Jun 2008 15:54:46 +0100
To: "'XuAnthony'" <xuhaitiancn@msn.com>, <xmlschema-dev@w3.org>
Message-ID: <AF6B183EA5D74248B16A88C167CF485D@Sealion>
RE: help me on the method of import in the schema
Because the prefix "lib" refers to the namespace
http://dyomedea.com/ns/library, your references to lib:name and lib:person
are references to the element declarations named "name" and "person" in the
schema document for target namespace http://dyomedea.com/ns/library. So you
have indeed defined them.
 
I notice that in your instance document
 
<library xlmns=http://dyomedea.com/ns/library
 
"xmlns" is misspelled. This could cause a great deal of confusion! In fact,
I see your schema even declares an attribute with this name
 
<xs: attribute name="xlmns" use="required">
 
presumably because the schema was generated from the instance?
 
Michael Kay
http://www.saxonica.com/


  _____  

From: xmlschema-dev-request@w3.org [mailto:xmlschema-dev-request@w3.org] On
Behalf Of XuAnthony
Sent: 18 June 2008 05:27
To: xmlschema-dev@w3.org
Subject: help me on the method of import in the schema



Dear sir:

i wonder the following examples of the import method  in the schema?

following is the chinese character question:

 

ÏÂÃæµÄÒÉÎÊÀïÃæ£ºdoublenamespacefix1.xsd ÎļþÖÐÓÐ 

<xs: element ref="lib: name"/> ºÍ <xs:element ref="lib: person"/> µ«ÎÒÔÚÕâ¸ö
ÎĵµÀïÃæÃ»Óж¨Òå¹ý lib: name ºÍ lib: person, Ö»¶¨Òå¹ý <xs: element
name="name" type="xs: string"/> ºÍ <xs: element name="person">£¬ÄÇô£¬lib:
nameºÍlib:  person Ö¸Ê²Ã´ÄØ£¿

3.xmlÎĵµÖÐ

 <book id="b0836217462" xmlns: lib="http://dyomedea.com/ns/library"> ¡£¡£¡£
</book> ÒýÓõÄlib,¸Ãlib ÃüÃû¿Õ¼äÊÇ´æÔÚÓÚ£¨»òÓÉ£©doublenamespacefix.xsd ¶¨Òå
ÄØ£¿»¹ÊÇ ÓÉ doublenamespacefix1.xsd À´¶¨ÒåÄØ£¿

4.<lib: authors>¡£¡£¡£</lib: authors>ÎÒÖªµÀÓÉÃû³ÆÎªlibµÄÃüÃû¿Õ¼äÏÞ¶¨£¬µ«¾¿¾¹
ÊÇ doublenamespacefix.xsd ¶¨ÒåÄØ£¿»¹ÊÇ ÓÉ doublenamespacefix1.xsd À´¶¨ÒåÄØ£¿
Á½¸ö¶¼ÓÐ<xs: schema xmlns: lib="http://dyomedea.com/ns/library" ¡£¡£¡£¡£

5. Ϊɶdoublenamespacefix1.xsd ÓÐ targetnamespace,¶ødoublenamespacefix.xsd
ûÓÐÄØ£¿

6. ΪʲôxmlÎĵµÀïÃæÒª¼Ó noNamespaceSchemaLocation£¿×öɶÓã¿

лл¡£

 

1. in the following example, those <xs: element ref="lib: name"/> and
<xs:element ref="lib: person"/> indicate that i should hvae defined a
lib:name and lib:person, but i never defined a thing like that in the
following whole codes?

so , what is the lib:name and lib:person?

2. in the following codes

   <book id="b0836217462" xmlns: lib="http://dyomedea.com/ns/library">
¡£¡£¡£</book> ,the lib is defined by doublenamespacefix.xsd  or
doublenamespacefix1.xsd ?

3. the .<lib: authors>¡£¡£¡£</lib: authors>, authors is defined in the
doublenamespacefix.xsd  or doublenamespacefix1.xsd ?

4. why there is  targetnamespace in the doublenamespacefix1.xsd,but there is
not any targetnamespace doublenamespacefix.xsd?

5  why the xml instance in the following whole codes has the
noNamesapceSchemaLocation? what is the usage and meaning of the
noNamespaceSchemalocation?

 

could you give the some detail examples and explainations of those detail
examples? thank you very much .

 

the next is the full example:(whole codes)

 

 

 

doublenamespacefix.xml 

XML code 

<?xml version="1.0"?>

<!-- Namespace: http://dyomedea.com/ns/library -->

<library xlmns="http://dyomedea.com/ns/library" xmlns:
xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:
noNamespaceSchemaLocation="k:\ѧµçÄÔ\¸öÈËÍøÕ¾Éè¼Æ
\XMLTRY~1\doublenamespaceFix.xsd">

    <!-- <library xmlns:l="http://dyomedea.com/ns/library"
xlmns="http://dyomedea.com/ns/library" xmlns:
xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:
schemaLocation="http://dyomedea.com/ns/library I:\ѧµçÄÔ\¸öÈËÍøÕ¾Éè¼Æ
\XMLTRY~1\doublenamespace.xsd"> -->

    <book id="b0836217462" xmlns: lib="http://dyomedea.com/ns/library">

            <title> 

               Being a Dog Is a Full-Time Job 

            </title>

        <lib: authors>

            <person id="CMS" xmlns="http://dyomedea.com/ns/library">

                  <name> 

                      Charles M Schulz 

                  </name>

            </person>

        </lib: authors>

    </book>

</library>

 



doublenamespacefix.xsd 

XML code 

 

<?xml version="1.0" encoding="UTF-8"?>

<xs: schema xmlns: lib="http://dyomedea.com/ns/library" xmlns:
xs="http://www.w3.org/2001/XMLSchema">

    <xs: import namespace="http://dyomedea.com/ns/library"
schemaLocation="doublenamespaceFix1.xsd"/>

    <xs: element name="title" type="xs: string"/>

    <xs: element name="library">

        <xs: complexType>

            <xs: sequence>

                <xs: element ref="book"/>

            </xs: sequence>

            <xs: attribute name="xlmns" use="required">

                <xs: simpleType>

                    <xs: restriction base="xs: anyURI">

                        <xs: enumeration
value="http://dyomedea.com/ns/library"/>

                    </xs: restriction>

                </xs: simpleType>

            </xs: attribute>

        </xs: complexType>

    </xs: element>

    <xs: element name="book">

        <xs: complexType>

            <xs: sequence>

                <xs: element ref="title"/>

                <xs: element ref="lib: authors"/>

            </xs: sequence>

            <xs: attribute name="id" use="required">

                <xs: simpleType>

                    <xs: restriction base="xs: string">

                        <xs: enumeration value="b0836217462"/>

                    </xs: restriction>

                </xs: simpleType>

            </xs: attribute>

        </xs: complexType>

    </xs: element>

</xs: schema>

 



doublenamespacefix1.xsd 

XML code 

 

<?xml version="1.0" encoding="UTF-8"?>

<xs: schema xmlns:lib="http://dyomedea.com/ns/library" xmlns:
xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://dyomedea.com/ns/library">

    <xs: element name="person">

        <xs: complexType>

            <xs: sequence>

                <xs:e lement ref="lib: name"/>

            </xs: sequence>

            <xs: attribute name="id" use="required">

                <xs: simpleType>

                    <xs: restriction base="xs: string">

                        <xs: enumeration value="CMS"/>

                    </xs: restriction>

                </xs: simpleType>

            </xs: attribute>

        </xs: complexType>

    </xs: element>

    <xs: element name="name" type="xs: string"/>

    <xs: element name="authors">

        <xs: complexType>

            <xs: sequence>

                <xs: element ref="lib: person"/>

            </xs: sequence>

        </xs: complexType>

    </xs: element>

</xs: schema>

 


  _____  

Windows Live Writer£¬Ö§³ÖÀëÏß׫д²©¿ÍÄÚÈÝ£¬ËæÊ±ËæµØÏëд¾Íд¡£ Á¢¼´Ê¹Óã¡
<http://get.live.cn/product/writer.html>  
Received on Wednesday, 18 June 2008 14:55:29 GMT

Subscribe to the Stylus Scoop newsletter for helpful XML tips and tutorials.
Email
First Name
Last Name
Company

Download Stylus Studio 6 XML Enterprise Edition

Subscribe in XML format
RSS 2.0
Atom 0.3
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-2007 All Rights Reserved.