zoukankan      html  css  js  c++  java
  • xml schema 建立xml文档

    web-app_2_5.xsd

    <?xml version="1.0" encoding="UTF-8"?>
    <!-- 
        传智播客Schema教学实例文档。
        模拟servlet2.5规范,如果开发人员需要在xml使用当前Schema约束,必须包括指定命名空间。
        格式如下:
        <web-app xmlns="http://www.example.org/web-app_2_5" 
                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                xsi:schemaLocation="http://www.example.org/web-app_2_5 web-app_2_5.xsd"
                version="2.5">
    -->
    <xsd:schema xmlns="http://www.w3.org/2001/XMLSchema" 
        targetNamespace="http://www.example.org/web-app_2_5"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        xmlns:tns="http://www.example.org/web-app_2_5" 
        elementFormDefault="qualified">
        
        <xsd:element name="web-app">
            <xsd:complexType>
                <xsd:choice minOccurs="0" maxOccurs="unbounded">
                    <xsd:element name="servlet">
                        <xsd:complexType>
                            <xsd:sequence>
                                <xsd:element name="servlet-name"></xsd:element>
                                <xsd:element name="servlet-class"></xsd:element>
                            </xsd:sequence>
                        </xsd:complexType>
                    </xsd:element>
                    <xsd:element name="servlet-mapping">
                        <xsd:complexType>
                            <xsd:sequence>
                                <xsd:element name="servlet-name"></xsd:element>
                                <xsd:element name="url-pattern" maxOccurs="unbounded"></xsd:element>
                            </xsd:sequence>
                        </xsd:complexType>
                    </xsd:element>
                    <xsd:element name="welcome-file-list">
                        <xsd:complexType>
                            <xsd:sequence>
                                <xsd:element name="welcome-file" maxOccurs="unbounded"></xsd:element>
                            </xsd:sequence>
                        </xsd:complexType>
                    </xsd:element>
                </xsd:choice>
                <xsd:attribute name="version" type="double" use="optional"></xsd:attribute>
            </xsd:complexType>
        </xsd:element>
    </xsd:schema>

    web.xml

    <?xml version="1.0" encoding="UTF-8"?>
    <web-app xmlns="http://www.example.org/web-app_2_5" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://www.example.org/web-app_2_5 web-app_2_5.xsd"
        version="2.5">
    
        <servlet>
            <servlet-name>helloServlet</servlet-name>
            <servlet-class>xxxxxxxxxx</servlet-class>
        </servlet>
        <servlet-mapping>
            <servlet-name>helloServlet</servlet-name>
            <url-pattern>/hello</url-pattern>
        </servlet-mapping>
    </web-app>
  • 相关阅读:
    UVA11174村民排队问题
    UVA11174村民排队问题
    UVA11137(立方数之和)
    UVA11137(立方数之和)
    UVA11134传说中的车(放棋子)
    UVA11134传说中的车(放棋子)
    UVA11100旅行(大包装小包,问最少多少个包)
    UVA11100旅行(大包装小包,问最少多少个包)
    UVA11078开放式学分制(前面-后面的最大值)
    UVA11078开放式学分制(前面-后面的最大值)
  • 原文地址:https://www.cnblogs.com/ms-grf/p/7045025.html
Copyright © 2011-2022 走看看