java學習

          java學習

           

          schema的筆記


          schema文件:
          <?xml version="1.0" encoding="UTF-8"?>
          <schema xmlns="  targetNamespace="  xmlns:tns="  elementFormDefault="qualified">
           <element name="user">
            <complexType>
             <sequence>
              <element name="id" type="int"/>
              <element name="username" type="string"/>
              <element name="born" type="date"/>
             </sequence>
            </complexType>
           </element>
          </schema>

          xml文件1:
          <?xml version="1.0" encoding="UTF-8"?>
          <user xmlns="
             xmlns:xsi="   xsi:schemaLocation=" <id>1</id>
           <username>zhangsan</username>
           <born>1989-12-22</born>
          </user>

          xml文件2:
          <?xml version="1.0" encoding="UTF-8"?>
          <user xmlns="
             xmlns:xsi="   xsi:noNamespaceSchemaLocation="01.xsd">
            <id>11</id>
            <username>lisi</username>
            <born>1988-11-11</born>
          </user>

          schema文件2:

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

           <element name="books">
            <complexType>
            <!-- maxOccurs表示最大出現次數 -->
             <sequence maxOccurs="unbounded">
              <element name="book">
               <complexType>
                <sequence minOccurs="1" maxOccurs="unbounded">
                 <element name="title" type="string" />
                 <element name="content" type="string" />
                 <choice>
                  <element name="author" type="string" />
                  <element name="authors">
                   <complexType>
                    <all><!-- 每個元素只能出現一次 -->
                     <element name="author" type="string"/>
                    </all>
                   </complexType>
                  </element>
                 </choice>
                </sequence>
                <attribute name="id" type="int" use="required"/>
               </complexType>
              </element>
             </sequence>
            </complexType>
           </element>

          </schema>


          xml文件:
          <?xml version="1.0" encoding="UTF-8"?>
          <book:books xmlns:book="
             xmlns:xsi="   xsi:noNamespaceSchemaLocation="02.xsd">
           <book:book id="1">
            <book:title>Java in action</book:title>
            <book:content>Java is good</book:content>
            <book:author>Bruce</book:author>
           </book:book>
           <book:book id="2">
            <book:title>SOA in action</book:title>
            <book:content>soa is difficult</book:content>
            <book:authors>
             <book:author>Jike</book:author>
            </book:authors>
           </book:book>
          </book:books>

          schema文件3:
          <?xml version="1.0" encoding="UTF-8"?>
          <schema xmlns="
            targetNamespace="  xmlns:tns="  elementFormDefault="qualified">
            
           <element name="person" type="tns:personType"/>
           
           <complexType name="personType">
            <sequence>
             <element name="name" type="string"/>
             <element name="age" type="tns:ageType"/>
             <element name="email" type="tns:emailType"/>
            </sequence>
            <attribute name="sex" type="tns:sexType"/>
           </complexType>
           
           <simpleType name="emailType">
            <restriction base="string">
             <pattern value="(\w+\.*)*\w+@\w+\.[A-Za-z]{2,6}"/>
             <minLength value="6"/>
             <maxLength value="255"/>
            </restriction>
           </simpleType>
           
           <simpleType name="ageType">
            <restriction base="int">
             <minInclusive value="1"/>
             <maxExclusive value="150"/>
            </restriction>
           </simpleType>
           
           <simpleType name="sexType">
            <restriction base="string">
             <enumeration value="男"/>
             <enumeration value="女"/>
            </restriction>
           </simpleType>
          </schema>

          xml文件:
          <?xml version="1.0" encoding="UTF-8"?>
          <person xmlns="
             xmlns:xsi="   xsi:schemaLocation="  <name>搜索</name>
            <age>149</age>
            <email>sadf@sdf.css</email>
          </person>

          schema文件4:




          posted on 2013-08-13 09:58 楊軍威 閱讀(199) 評論(0)  編輯  收藏


          只有注冊用戶登錄后才能發表評論。


          網站導航:
           

          導航

          統計

          常用鏈接

          留言簿

          隨筆檔案

          搜索

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 阜阳市| 南皮县| 北海市| 孟州市| 扶沟县| 南靖县| 商都县| 松滋市| 五家渠市| 芜湖县| 鄄城县| 清水县| 西城区| 项城市| 崇仁县| 娄烦县| 黄骅市| 宣武区| 巴南区| 溆浦县| 胶南市| 靖州| 石渠县| 汝阳县| 体育| 衡阳县| 敦煌市| 桂阳县| 新乐市| 湘潭市| 大名县| 赣榆县| 博罗县| 孟村| 搜索| 长岭县| 台前县| 汉川市| 枣阳市| 东平县| 射洪县|