zoukankan      html  css  js  c++  java
  • SCHEMA约束

    SCHEMA约束:
        一个xml文档中可以添加多个schema约束
        xml和schema的关联.
            格式:
                <根标签 xmlns="..." ...>
                <根标签 xmlns:别名="..." ...>
        名称空间:
            关联约束文件
            规定元素是来源于那个约束文件的
        例如:
            一个约束文件中规定 table(表格)  表格有属性 row和col
            还有一个约束文件规定 table(桌子) 桌子有属性 width和height
     
            在同一个xml中万一我把两个约束文件都导入了,
                在xml中我写一个table,这个table有什么属性????
            我们为了避免这种情况的发生,可以给其中的一个约束起个别名
            使用的时候若是没有加别名那就代表是来自于没有别名的约束文件
                例如 table(表格) 给他起个别名  xmlns:a="..."
                在案例中使用 a:table 代表的是表格
                若在案例中直接使用 table 代表的是桌子
            在一个xml文件中只能有一个不起别名;
    注意:
        schema约束本身也是xml文件.
    文档头解析:
     1 //一个完整的SCHEMA约束文档
     2 <?xml version="1.0" encoding="UTF-8"?>
     3 <!-- 
     4     传智播客Schema教学实例文档。
     5     模拟servlet2.5规范,如果开发人员需要在xml使用当前Schema约束,必须包括指定命名空间。
     6     格式如下:
     7     <web-app xmlns="http://www.example.org/web-app_2_5" 
     8             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     9             xsi:schemaLocation="http://www.example.org/web-app_2_5 web-app_2_5.xsd"
    10             version="2.5">
    11 -->
    12 <xsd:schema xmlns="http://www.w3.org/2001/XMLSchema" 
    13     targetNamespace="http://www.example.org/web-app_2_5"
    14     xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    15     xmlns:tns="http://www.example.org/web-app_2_5" 
    16     elementFormDefault="qualified">
    17 
    18     <xsd:element name="web-app">
    19         <xsd:complexType>
    20             <xsd:choice minOccurs="0" maxOccurs="unbounded">
    21                 <xsd:element name="servlet">
    22                     <xsd:complexType>
    23                         <xsd:sequence>
    24                             <xsd:element name="servlet-name"></xsd:element>
    25                             <xsd:element name="servlet-class"></xsd:element>
    26                         </xsd:sequence>
    27                     </xsd:complexType>
    28                 </xsd:element>
    29                 <xsd:element name="servlet-mapping">
    30                     <xsd:complexType>
    31                         <xsd:sequence>
    32                             <xsd:element name="servlet-name"></xsd:element>
    33                             <xsd:element name="url-pattern"></xsd:element>
    34                         </xsd:sequence>
    35                     </xsd:complexType>
    36                 </xsd:element>
    37                 <xsd:element name="welcome-file-list">
    38                     <xsd:complexType>
    39                         <xsd:sequence>
    40                             <xsd:element name="welcome-file" maxOccurs="unbounded"></xsd:element>
    41                         </xsd:sequence>
    42                     </xsd:complexType>
    43                 </xsd:element>
    44             </xsd:choice>
    45             <xsd:attribute name="version" type="double" use="optional"></xsd:attribute>
    46         </xsd:complexType>
    47     </xsd:element>
    48 </xsd:schema>
  • 相关阅读:
    jquery加入购物车飞入的效果
    jQuery点击div其他地方隐藏div
    移动对meta的定义
    ZOJ
    博弈dp入门 POJ
    ZOJ 2967计算几何+单调栈
    牛客训练41D最小相似度bfs
    球的体积并
    二进制上的数位dpPOJ 3252
    数位dp入门 HDU 2089 HDU 3555
  • 原文地址:https://www.cnblogs.com/anzhi/p/7447541.html
Copyright © 2011-2022 走看看