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)  編輯  收藏


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


          網站導航:
           

          導航

          統計

          常用鏈接

          留言簿

          隨筆檔案

          搜索

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 班戈县| 鹤庆县| 响水县| 东台市| 霍城县| 广宗县| 紫金县| 德钦县| 和顺县| 泗阳县| 安义县| 荥阳市| 湖南省| 厦门市| 平邑县| 广饶县| 郸城县| 靖安县| 鸡西市| 竹北市| 库尔勒市| 彰化市| 铜梁县| 永嘉县| 任丘市| 边坝县| 获嘉县| 敖汉旗| 赤水市| 普兰店市| 阳泉市| 文昌市| 尉犁县| 富锦市| 喀喇| 体育| 吕梁市| 辽宁省| 揭西县| 上思县| 汶川县|