zoukankan      html  css  js  c++  java
  • 40、dom以xml结尾的文件

    1、student.xml文件

    <?xml version="1.0" encoding="utf-8" ?>
    <!-- 
        1.书写根元素(因为xsd文件的引入是在根元素上进行的)
        2.在根元素上书写schemaLocation属性,填入命名空间,和xsd文件位置.(可以引入多个,没对之间用 空格/回车 隔开.)
        3.为引入的xsd定义一个前缀.xmlns="http://www.itcast.cn/xml"
        4.固定值. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     -->
     <students  xmlns="http://www.itcast.cn/xml" 
                 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
                 xsi:schemaLocation="http://www.itcast.cn/xml students.xsd" >
             <student number="ITCAST_0001">
                 <name>tom</name>
                 <age>18</age>
                 <sex>male</sex>
             </student>               
     </students>

    2、student.xsd文件

    <?xml version="1.0"?>
    <xsd:schema xmlns="http://www.itcast.cn/xml"
            xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            targetNamespace="http://www.itcast.cn/xml" elementFormDefault="qualified">
        <xsd:element name="students" type="studentsType"/>
        <xsd:complexType name="studentsType">
            <xsd:sequence>
                <xsd:element name="student" type="studentType" minOccurs="0" maxOccurs="unbounded"/>
            </xsd:sequence>
        </xsd:complexType>
        <xsd:complexType name="studentType">
            <xsd:sequence>
                <xsd:element name="name" type="xsd:string"/>
                <xsd:element name="age" type="ageType" />
                <xsd:element name="sex" type="sexType" />
            </xsd:sequence>
            <xsd:attribute name="number" type="numberType" use="required"/>
        </xsd:complexType>
        <xsd:simpleType name="sexType">
            <xsd:restriction base="xsd:string">
                <xsd:enumeration value="male"/>
                <xsd:enumeration value="female"/>
            </xsd:restriction>
        </xsd:simpleType>
        <xsd:simpleType name="ageType">
            <xsd:restriction base="xsd:integer">
                <xsd:minInclusive value="0"/>
                <xsd:maxInclusive value="120"/>
            </xsd:restriction>
        </xsd:simpleType>
        <xsd:simpleType name="numberType">
            <xsd:restriction base="xsd:string">
                <xsd:pattern value="ITCAST_d{4}"/>
            </xsd:restriction>
        </xsd:simpleType>
    </xsd:schema> 

    3、country.css

    c1 {
        font-size:200px;
        color:red;
    }
    c2 {
        font-size:100px;
        color:green;
    }
    c3 {
        font-size:10px;
        color:yellow;
    }
    c4 {
        font-size:150px;
        color:blue;
    }
    //country.xml文件
    <?
    xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet type="text/css" href="country.css"?> <c> <c1>中国</c1> <c2>美国</c2> <c3>日本</c3> <c4>英国</c4> </c>

    4、hello.xml文件

    <?xml version="1.0" encoding="gbk" ?>
    <students>
        <!-- 下面是一个问题学生 
        -->
        <student number="itcast_0001" >
            <name>&lt;tom&gt;</name>
            <age>18</age>
            <sex>male</sex>
            <code><![CDATA[<><><><><<><><]]></code>
        </student>
    </students>

    5、student.dtd文件

    <!ELEMENT students (student*) >
    <!ELEMENT student (name,age,sex)>
    <!ELEMENT name (#PCDATA) >
    <!ELEMENT age (#PCDATA) >
    <!ELEMENT sex (#PCDATA) >
    <!ATTLIST student number ID #REQUIRED>
  • 相关阅读:
    用Processing生成屏保(二)
    NTFS文件系统
    用processing生成屏保程序
    用processing画李萨如曲线
    processing模拟三角级数合成方波过程
    express 设置 cookie 以及 httpOnly
    vue 使用 axios 时 post 请求方法传参无法发送至后台
    微信小程序访问后台出现 对应的服务器证书无效。控制台输入 showRequestInfo() 可以获取更详细信息。
    微信长按识别二维码,在 vue 项目中的实现
    vue-cli 构建的 Vue 项目用 localhost 加 端口 能访问,但是切换到 ip 加 端口 就不能访问
  • 原文地址:https://www.cnblogs.com/weizhen/p/5995058.html
Copyright © 2011-2022 走看看