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分钟就退出删除了. 这次硬着头皮,打开几篇文章都看完 ...
随机推荐
- 购物车redis存储结构
- forkjoin框架疑问记录
今天在看jdk1.7的forkjoin框架时候,里面有个例子如下: product类: public class Product { private String name; private doub ...
- apache 配置PHP的支持重写伪静态
1.开启rwrite模块 LoadModule rewrite_module modules/mod_rewrite. 允许任何目录使用.htaccess AllowOverride None 改成 ...
- YII+DWZ三级城市联动挂件
挂件PHP文件 class CountryCityCombox extends RXWidget { public $provinceId = 2; public $cityId = 3687; pu ...
- 导入自定义模块model
编写m2.py,脚本内容如下: #!/usr/bin/python # -*- coding: utf-8 -*- 'its a module test' __author__ = 'mm' impo ...
- 8086 CPU 寄存器简介
转载:http://www.cnblogs.com/BoyXiao/archive/2010/11/20/1882716.html 引子 打算写几篇稍近底层或者说是基础的博文,浅要介绍或者说是回顾一些 ...
- rabbitmq集群步骤
这里选用三台主机,主机名分别是hidden1, hidden2, hidden3 主机名一定要修改成不一样的,要不然加入集群的时候会加入不成功 修改完主机名后,在/etc/hosts文件中加入对应的解 ...
- Win10笔记本显卡驱动更新升级
对于游戏玩家来说,对显卡的关注度要高于电脑其它硬件,一般来说,显卡越好,游戏性能往往越强.不过要持续发挥显卡的最佳游戏性能,经常更新显卡驱动也是很有必要的.那么笔记本显卡驱动怎么更新?下面小编以自己的 ...
- matlab中的决策树
1.函数 view(t)%画出决策树 prune %剪枝决策树 t2=prune(t,'level','level'/'node')%level:0 不剪枝 1 剪掉最后一层 2 最后两层%node: ...
- opencv python3.6安装和测试
安装: 命令行 pip install D:\python3.6.1\Scriptsopencv_python-3.2.0-cp36-cp36m-win_amd64.whl 测试代码: import ...