一.实验目的编辑器
一、掌握XML1.0的标准及内容ide
二、掌握XML的基本格式url
三、掌握XML SPY或VSCode的基本使用方法spa
二.实验内容设计
一、使用XML Spy或记事本等文本编辑器编辑以下XML文档,并保存文件名为code1_1.xml,而后在IE中浏览。3d
<?xml version="1.0" encoding="gb2312" ?>code
<orders>xml
<order>blog
<customerID>c0500069</customerID>ip
<order_date>20050517</order_date>
<order_status>pending</order_status>
<items>
<item>
<bookID>001</bookID>
<quantity>10</quantity>
<item_status>pending</item_status>
</item>
</items>
</order>
<order>
<customerID>c500701</customerID>
<order_date>20050712</order_date>
<order_status>pending</order_status>
<items>
<item>
<bookID>002</bookID>
<quantity>30</quantity>
<item_status>pending</item_status>
</item>
<item>
<bookID>003</bookID>
<quantity>20</quantity>
<item_status>pending</item_status>
</item>
</items>
</order>
</orders>
二、下面是一个网上购物订单,将它写成XML格式,并用XML SPY或VSCode编辑,保存为code1_2.xml。
顾客编号:X00349827,订单号:DD934809,定货时间:2004-05-17;
付款方式:邮局汇款,通信地址:xxx市xxx路xxx号,邮编:123456;
汇款地址:yyy市yyy路yyy号,收款人xxxx书店;
定书号:001,书名:AAA,数量:1,价格:34.00;
定书号:002,书名:BBB,数量:1,价格:29.00;
定书号:003,书名:CCC,数量:1,价格:41.00。
一.实验目的
一、掌握DTD的定义、引用
二、掌握DTD的验证
三、掌握XML Schema的定义、引用
四、掌握XML Schema的验证
五、了解XML Schema中名称空间的使用
二.实验内容
一、如图所示,为其设计XML及其对应的DTD,分别命名为code2_1.xml、code2_1.dtd。
二、在一个XML文档中,须要用到一个article的结点,这个结点结构以下:
<article>
<HeadLine section="business">
<MainHead>Main headline goes here</MainHead>
<SubHead>A subheadline goes here</SubHead>
</HeadLine>
<ByLine>
<Author>John Doe</Author>
<title>Reporter</title>
</ByLine>
<DateLine>April 30, 2005</Dateline>
<body>Content of story goes here…</body>
<stats>
<submitted>2005-03-02</submitted>
<wordCount>1523</wordCount>
</stats>
</article>
(1)请在分别定义HeadLine、ByLine、DateLine、stats结点的数据类型基础上,再定义article的复杂数据类型。
(2)若以上程序段多篇文章(articles),XML保存为code2_2.xml请为其创建完整的XML Schema文件,保存文件名为code2_2.xsd。
三、为 如下XML 文档设计对应的XML Schema文件,保存文件名为code2_3.xsd,XML文件保存为code2_3.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<shiporder orderid="889923"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="shiporder.xsd">
<orderperson>George Bush</orderperson>
<shipto>
<name>John Adams</name>
<address>Oxford Street</address>
<city>London</city>
<country>UK</country>
</shipto>
<item>
<title>Empire Burlesque</title>
<note>Special Edition</note>
<quantity>1</quantity>
<price>10.90</price>
</item>
<item>
<title>Hide your heart</title>
<quantity>1</quantity>
<price>9.90</price>
</item>
</shiporder>
一.实验目的
一、掌握XML 和 CSS显示的方法
二、了解XSLT使用方法
三、体会二者的区别。
二.实验内容
一、按要求完成案例(以下图),其功能是实现后台管理的界面显示。
(1)编辑 XML文档,如code3_1.xml。
(2)编写对应的 XSLT 样式表,如code3_1.xsl。
(3)显示这个由 XSLT 样式表格式化的界面。
一.实验目的
一、掌握Java使用DOM加载XML的方法;
二、掌握使用DOM建立XML文件的方法;
三、学会转换XML文件为HTML的方法。
二.实验内容
一、示例6.1,使用Java语言解析XML文件,建立XML节点。
二、示例5.12。使用Java语言转换XML文件为HTML的方法。