zoukankan      html  css  js  c++  java
  • XSD的题目及解答

    一 题目

    <?xml version="1.0" encoding="gb2312"?> 

    <!DOCTYPE roster SYSTEM "3.14.dtd">
    <roster>
    <class id="c101">
    <monitor ip="s101"/>
    <department>信息工程</department>
    <specialty>计算机应用</specialty>
    </class>
    <student ID="s101" type="特长生">
    <name>李华</name>
    <sex>男</sex>
    <classto idf="c101"/>
    </student>
    <student ID="s102">
    <name byname=“西门飘雪”>张谦</name>
    <classto idf="c101"/>
    </student>

    </roster>

    二 解答结果

    <?xml version="1.0"?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

    <xs:element name="roster">
    <xs:complextType name="roster">
    <xs:element name="classtype"/>
    <xs:complexType>
    <xs:sequence>
    <xs:element name="stutype"/>
    <xs:element name="stutype"/>
    </xs:sequence>
    </xs:complexType>
    </xs:complextType>
    </xs:element>


    <xs:element name="class" type="classtype">

    <xs:complextType>
    <xs:sequence>
    <xs:element name="monitor">
    <xs:attribute name="ip" type="xs:string"/>
    </xs:element>
    <xs:element name="department" type="xs:string">
    </xs:element>
    <xs:element name="specialty" type="xs:string">
    </xs:element>
    </xs:sequence>

    <xs:attribute name="id" type="xs:string" use="required"/>
    </xs:complextType>
    </xs:element>

    <xs:element name="student" type="stutype">
    <xs:complextType>
    <xs:sequence>
    <xs:element name="name" type="xs:string">
    </xs:element>
    <xs:element name="sex" type="xs:string">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:pattern value="男 | 女" />
    </xsd:restriction>
    </xsd:simpleType>
    </xs:element>
    <xs:element name="classto" type="xs:string">
    <xs:attribute name="idf" type="xs:string"/>
    </xs:element>
    <xs:attribute name="ID" type="xs:string"/>
    <xs:attribute name="type" type="xs:string" minOccurs="0"/>
    </xs:sequence>
    </xs:complextType>
    </xs:element>

    </xs:schema>

  • 相关阅读:
    1052 Linked List Sorting (25 分)
    1051 Pop Sequence (25 分)
    1050 String Subtraction (20 分)
    1049 Counting Ones (30 分)
    1048 Find Coins (25 分)
    1047 Student List for Course (25 分)
    1046 Shortest Distance (20 分)
    1045 Favorite Color Stripe (30 分)
    1044 Shopping in Mars (25 分)
    1055 The World's Richest (25 分)
  • 原文地址:https://www.cnblogs.com/SoulSpirit/p/2935612.html
Copyright © 2011-2022 走看看