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分钟就退出删除了. 这次硬着头皮,打开几篇文章都看完 ...
随机推荐
- unity震动效果
using System.Collections; using System.Collections.Generic; using UnityEngine; //思想:在短时间内在规定圆内随机震动对象 ...
- input标签添加上disable属性在ios端字体颜色不兼容的问题
input[disabled],input:disabled,input.disabled{ color: #3e3e3e; -webkit-text-fill-color: #3e3e3e; -we ...
- .net 的page的OnInit方法
/// <summary> /// 重写父类的方法,父类要执行的方法已经被覆盖 /// </summary> /// <param name="e"& ...
- 微信开发平台中有个接口是上传多媒体文件,我用的是java 开发的,我怎么样才能在后台实现呢?
/** * 文件上传到微信服务器 * @param fileType 文件类型 * @param filePath 文件路径 * @return JSONObj ...
- 变换CALayer锚点实现模拟时钟的动画
变换CALayer锚点实现模拟时钟的动画 变换锚点得需要一点理论知识,看下图就能明白:). https://developer.apple.com/library/ios/documentation/ ...
- 使用@selector模仿代理功能降低代码耦合度
使用@selector模仿代理功能降低代码耦合度 说明 该模式的好处就是两个产生联系的对象间并没有具体的耦合代码,增删改查均很直观 源码 Model // // Model.h // SELMetho ...
- CSMA/CD 续
重要特性 以太网不能进行全双工通信而只能进行双向交替通信(半双工通信).每个站在发送数据之后的一小段时间内,存在着遭遇碰撞的可能性. 这种发送的不确定性使整个以太网的平均通信量远小于以太网的最高数据率 ...
- TCP/IP 协议图--计算机网络体系结构分层
计算机网络体系结构分层 计算机网络体系结构分层 不难看出,TCP/IP 与 OSI 在分层模块上稍有区别.OSI 参考模型注重“通信协议必要的功能是什么”,而 TCP/IP 则更强调“在计算机上实 ...
- 枚举类型与位域枚举Enum
一.概述 定义一个值类型,其中包含固定值集合.枚举类型变量可以是此集合中的任意一个或多个值.枚举使用enum关键字来声明,与类同级.枚举本身可以有修饰符,但枚举的成员始终是公共的,不能有访问修饰符.枚 ...
- HttpClient简述
HttpClient相比传统JDK自带的URLConnection,增加了易用性和灵活性,它不仅是客户端发送Http请求变得容易,而且也方便了开发人员测试接口(基于Http协议的),即提高了开发的效率 ...