XML第一次简单入门(Lab分析)
In this tutorial you will create a well-formed and verified XML file. Consider the XML document below
<?xml version="1.0"?>
<!DOCTYPE ancient_wonders [
<!ELEMENT ancient_wonders (wonder*)>
<!ELEMENT wonder (name, location, height)>
<!ELEMENT name (#PCDATA)>
<!ELEMENT location (#PCDATA)>
<!ELEMENT height (#PCDATA)>
<!ATTLIST height units CDATA #REQUIRED>
]>
<ancient_wonders>
<wonder>
<name>Colossus of Rhodes</name>
<location>Rhodes, Greece</location>
<height units="feet">107</height>
</wonder>
</ancient_wonders>
1. In the above XML document, add another ancient wonder element for the "Great Pyramid of Giza" located at Giza in Egypt and with the height of 455 feet. Save as “ancient-wonders.xml”
2. For element of Collossus of Rhodes in this XML document, just below the element, add an empty element <main_image> with attribute filename whose value is “colossus.jpg”.
3. Accomodate the DTD of “ancient-wonders.xml” to question 2.
4. Validate ancient-wonders.xml using xmllint.
5. Copy the “ancient_wonders” instance at the top (without DTD) to the XML instance document “ancient-wondersxsd.xml”.
6. Build an xml schema definition for ancient-wonders-xsd.xml and save it as “ancient-wonders.xsd”.
7. Validate the “ancient-wonders-xsd.xml” against “ancient-wonders.xsd” using xmllint. Submit the three documents via Stream.
第一,二,三问:
ancident-wonders.xml
<?xml version="1.0"?>
<!DOCTYPE ancient_wonders[
<!ELEMENT ancient_wonders (wonder*)>
<!ELEMENT wonder (name, main_image?, location, height)>
<!ELEMENT name (#PCDATA)>
<!ELEMENT main_image EMPTY>
<!ATTLIST main_image filename CDATA #REQUIRED>
<!ELEMENT location (#PCDATA)>
<!ELEMENT height (#PCDATA)>
<!ATTLIST height units CDATA #REQUIRED>
]> <ancient_wonders>
<wonder>
<name>Colossus of Rhodes</name>
<main_image filename="colossus.jpg"/>
<location>Rhodes, Greece</location>
<height units="feet">107</height>
</wonder> <wonder>
<name>Great Pyramid of Giza</name>
<location>Giza, Egypt</location>
<height units="feet">455</height>
</wonder>
</ancient_wonders>
第五问:
<ancient_wonders>
<wonder>
<name>Colossus of Rhodes</name>
<main_image filename="colossus.jpg"/>
<location>Rhodes, Greece</location>
<height units="feet">107</height>
</wonder>
<wonder>
<name>Great Pyramid of Giza</name>
<location>Giza, Egypt</location>
<height units="feet">455</height>
</wonder>
</ancient_wonders>
第六问:
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="ancient_wonders">
<xs:complexType>
<xs:sequence minOccurs="0">
<xs:element name="wonder" type="wonder" maxOccurs="10"/>
</xs:sequence>
</xs:complexType>
</xs:element> <xs:complexType name="wonder">
<xs:sequence>
<xs:element name="name" type="xs:string"/>
<xs:element name="main_image" type="main_image" minOccurs="0"/>
<xs:element name="location" type="xs:string"/>
<xs:element name="height" type="height"/>
</xs:sequence>
</xs:complexType> <xs:complexType name="main_image">
<xs:attribute name="filename" type="xs:string" use="required"/>
</xs:complexType> <xs:complexType name="height">
<xs:simpleContent>
<xs:extension base="xs:integer">
<xs:attribute name="units" type="xs:string" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:schema>
然后利用xmllint验证dtd,schema(非该题的检验 这里只给出相似的过程结果)


如果有错,则会指出相应错误

把答案写下来 下次复习的时候过来看_(:зゝ∠)_
XML第一次简单入门(Lab分析)的更多相关文章
- JAVA Bean和XML之间的相互转换 - XStream简单入门
JAVA Bean和XML之间的相互转换 - XStream简单入门 背景介绍 XStream的简介 注解简介 应用实例 背景介绍 我们在工作中经常 遇到文件解析为数据或者数据转化为xml文件的情况, ...
- Asp.Net MVC学习总结(一)——Asp.Net MVC简单入门
一.MVC简单入门 1.1.MVC概念 视图(View) 代表用户交互界面,对于Web应用来说,可以概括为HTML界面,但有可能为XHTML.XML和Applet. 模型(Model) 表示用户对其数 ...
- Python 简单入门指北(一)
Python 简单入门指北(一) Python 是一门非常容易上手的语言,通过查阅资料和教程,也许一晚上就能写出一个简单的爬虫.但 Python 也是一门很难精通的语言,因为简洁的语法背后隐藏了许多黑 ...
- apache ftp server的简单入门(数据库验证)
apache的简单校验分为两种,一直是前面提到的properties的校验,具体参考:apache ftp server的简单入门(properties验证) 今天来说一种数据库的校验,这种方式在项目 ...
- ArcGIS for Desktop入门教程_第四章_入门案例分析 - ArcGIS知乎-新一代ArcGIS问答社区
原文:ArcGIS for Desktop入门教程_第四章_入门案例分析 - ArcGIS知乎-新一代ArcGIS问答社区 1 入门案例分析 在第一章里,我们已经对ArcGIS系列软件的体系结构有了一 ...
- 初学Python之爬虫的简单入门
初学Python之爬虫的简单入门 一.什么是爬虫? 1.简单介绍爬虫 爬虫的全称为网络爬虫,简称爬虫,别名有网络机器人,网络蜘蛛等等. 网络爬虫是一种自动获取网页内容的程序,为搜索引擎提供了重要的 ...
- 用IntelliJ IDEA创建Gradle项目简单入门
Gradle和Maven一样,是Java用得最多的构建工具之一,在Maven之前,解决jar包引用的问题真是令人抓狂,有了Maven后日子就好过起来了,而现在又有了Gradle,Maven有的功能它都 ...
- [原创]MYSQL的简单入门
MYSQL简单入门: 查询库名称:show databases; information_schema mysql test 2:创建库 create database 库名 DEFAULT CHAR ...
- emacs最简单入门,只要10分钟
macs最简单入门,只要10分钟 windwiny @2013 无聊的时候又看到鼓吹emacs的文章,以前也有几次想尝试,结果都是玩不到10分钟就退出删除了. 这次硬着头皮,打开几篇文章都看完 ...
随机推荐
- 在 Windows Server Container 中运行 Azure Storage Emulator(二):使用自定义的 SQL Server Instance
上一节,我们解决了 Azure Storage Emulator 自定义监听地址的问题,这远远不够,因为在我们 DEV/QA 环境有各自的 SQL Server Instance,我们需要将 ASE ...
- Python学习---装饰器的学习1210
装饰器的基础 学习前提: 作用域 + 函数的理解 + 闭包 [学习,理解] 代码编写原则: 对修改开放对扩展开放 装饰器本质上是一个函数,该函数用来处理其他函数,它可以让其他函数在不需要修改代码的前 ...
- Java学习---TCP Socket的学习
基础知识 1. TCP协议 TCP是一种面向连接的.可靠的.基于字节流的运输层(Transport layer)通信协议.在简化的计算机网络OSI模型中,它完成第四层传输层所指定的功能,UDP是同一层 ...
- Nginx性能问题答疑
为什么Nginx的总体性能比Apache高? Nginx使用的是epoll模型和kqueue的网络I/O模型Apache使用的是传统的select模型.目前linux的高并发场景使用的都是epoll模 ...
- 安装kubernetes 环境
master: 10.6.2.170 #master节点兼做仓库 node-1: 10.6.2.171 node-2: 10.6.2.172 1.添加host解析 # cat << ...
- MySQL 数据库--SQL语句优化
explain查询和分析sql 开发中,为满足一业务功能,使用mysql书写sql时,一条sql往往有多种写法,那么我们就需要选择执行效率比较高的sql. 因此要比较分析sql的执行过程,且同一条sq ...
- January 02 2017 Week 1st Monday
A day is a miniature of eternity. 一天是永恒的缩影. My life is short, but I can make something eternal. What ...
- Entity Framework 指定架构无效 错误:1052
IIS发布网站:如果不发布放到IIS没有问题,发布后IIS部署 打开网站却提示指定架构无效 1052 找到很多解决的问题 1添加wenconfig 2.更改entity名的 其实我认为最简单的就是先找 ...
- jq实现 元素显示后 点击页面的任何位置除元素本身外 隐藏元素
$(".share-weixin").on("click",function(e){ var $wx=$(".weixin-share"), ...
- 「NOIP2018 保卫王国」
题目 强制选点我们可以把那个点权搞成\(-inf\),强制不选我们搞成\(inf\),之后就真的成为动态\(dp\)的板子题了 由于不想像板子那样再写一个最大独立集的方程,之后利用最小点覆盖=总点权- ...