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 UTC