W3C home > Mailing lists > Public > xmlschema-dev@w3.org > June 2008

help me on the method of import in the schema

From: XuAnthony <xuhaitiancn@msn.com>
Date: Wed, 18 Jun 2008 04:27:26 +0000
Message-ID: <BAY130-W2866A2C7624A9BBC035F69B7AB0@phx.gbl>
To: <xmlschema-dev@w3.org>

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>
 
_________________________________________________________________
用手机MSN聊天写邮件看空间,无限沟通,分享精彩!
http://mobile.msn.com.cn/
Received on Wednesday, 18 June 2008 14:19:34 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:15:47 UTC