嘟嘟

            BlogJava :: 首頁 :: 聯(lián)系 :: 聚合  :: 管理
            26 Posts :: 0 Stories :: 6 Comments :: 0 Trackbacks

          常用鏈接

          留言簿(6)

          我參與的團(tuán)隊(duì)

          搜索

          •  

          最新評論

          閱讀排行榜

          評論排行榜

          Namespaces are a way to associate a group of elements with each other.
           
           <wire:order xmlns:wire="   <wire:store>
               <wire:shirt xmlns:wire="http:/www.wire-man.com/ns/shirts">                 <!-->覆蓋realname,不能覆蓋localname<-->
                 <wire:color>purple</wire:color>
               </wire:shirt>
             </wire:store>
           </wire:order>

          多個(gè)namespaces
           <wire:order xmlns:wire="
             <wire:store>
               <wire:shirt xmlns:stitch="http:/www.wire-man.com/ns/stitch">               <!-->2個(gè)<-->
                  <wire:color>
                     <stitch:shade>lavender</stitch:shade>
                  </wire:color>
               </wire:shirt>
             </wire:store>
           </wire:order>

          Namespaces and attributes
           元素前面加prefix,參數(shù)前面不用加

          Namespaces and DTDs
           DTD不支持Namespaces,只是當(dāng)作一個(gè)attribute.
           <?xml version="1.0" encoding="UTF-8"?>
           <!DOCTYPE  wire:order [
           <!ELEMENT wire:order (wire:store)>                                            <!-->元素前加上prefix<-->
           <!ATTLIST wire:order xmlns CDATA #FIXED "
           <!ELEMENT wire:store (#PCDATA)>
           ]>

           <wire:order xmlns=" <wire:store>Stitch Store</wire:store>
           </wire:order>

          Namespaces are not technically part of the XML 1.0 spec, thus,namespaces have nothing to do with the validity of an XML document.

          Namespace and XML Schema
            <!-->XML  FILE<-->
            <?xml version="1.0" encoding="UTF-8" ?>
            <pants:order
               xmlns:xsi="
               xsi:noNamespaceSchemaLocation="namespace2.xsd"
               xmlns:pants="
                  <store>30 paisley capri</store>                                        <!-->這個(gè)元素不在namespaces中<-->
            </pants:order>

            <!-->XML Schema FILE namespace2.xsd<-->
            <?xml version="1.0" encoding="UTF-8" ?>
            <xsd:schema                                                                  <!-->定義一個(gè)namespace所有內(nèi)容都飽含再一個(gè)xsd:schema元素內(nèi)<-->
           xmlns:xsd="
           targetNamespace=" xmlns:wire="  
           <xsd:element name="order">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="store" type="xsd:string" />
               </xsd:sequence>
              </xsd:complexType>
             </xsd:element>
            </xsd:schema>
           
            ××上面例子中注意xmlns:pants,targetNamespace, xmlns:wire是使用一樣得URI值。

            Assign the namespaces to all elements is elementFormDefault="qualified"
              ...
              <xsd:schema                                                                 
           xmlns:xsd="
           targetNamespace=" xmlns:wire="        elementFormDefault="qualified"> 
              ...
           
            Assign the namespaces to the individule element
              ...
              <xsd:element name="order">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="store" type="xsd:string" form="qualified"/>  <!-->***<-->
               </xsd:sequence>
              </xsd:complexType>
             </xsd:element>
             ...

            Exclude an element from the namespace
              ...
              <xsd:element name="order">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="store" type="xsd:string" form="unqualified"/>  <!-->***<-->
               </xsd:sequence>
              </xsd:complexType>
             </xsd:element>
             ...

          主站蜘蛛池模板: 虞城县| 庆安县| 封丘县| 甘谷县| 三都| 宁化县| 安岳县| 高邮市| 遂平县| 英山县| 保靖县| 沙坪坝区| 白城市| 虹口区| 普陀区| 西城区| 台东县| 大英县| 射洪县| 洛宁县| 封丘县| 绥中县| 普兰县| 宝兴县| 瑞金市| 抚顺县| 尼玛县| 佳木斯市| 天祝| 上饶市| 屯昌县| 桐庐县| 拉萨市| 崇明县| 唐河县| 镇巴县| 湾仔区| 鸡东县| 南京市| 十堰市| 云梦县|