XML编程与应用教程第二版上机答案.docx

上传人:b****6 文档编号:8860564 上传时间:2023-02-02 格式:DOCX 页数:51 大小:40.52KB
下载 相关 举报
XML编程与应用教程第二版上机答案.docx_第1页
第1页 / 共51页
XML编程与应用教程第二版上机答案.docx_第2页
第2页 / 共51页
XML编程与应用教程第二版上机答案.docx_第3页
第3页 / 共51页
XML编程与应用教程第二版上机答案.docx_第4页
第4页 / 共51页
XML编程与应用教程第二版上机答案.docx_第5页
第5页 / 共51页
点击查看更多>>
下载资源
资源描述

XML编程与应用教程第二版上机答案.docx

《XML编程与应用教程第二版上机答案.docx》由会员分享,可在线阅读,更多相关《XML编程与应用教程第二版上机答案.docx(51页珍藏版)》请在冰豆网上搜索。

XML编程与应用教程第二版上机答案.docx

XML编程与应用教程第二版上机答案

上机题

1、

xmlversion="1.0"encoding="gb2312"?

>

XML指南

XML入门简介

什么是HTML

什么是XML

XML语法

XML元素必须有结束标签

XML元素必须正确的嵌套

2、

xmlversion="1.0"encoding="gb2312"?

>

1

张三

32

上海

2

李四

22

北京

3、

xmlversion="1.0"encoding="gb2312"?

>

1

tom

100

2

mary

98

第三章

上机题

1、

xmlversion="1.0"encoding="GB2312"?

>

ELEMENT学生名册(学生+)>

ELEMENT学生(姓名,性别,年龄)>

ELEMENT姓名(#PCDATA)>

ELEMENT性别(#PCDATA)>

ELEMENT年龄(#PCDATA)>

ATTLIST学生学号ID#REQUIRED>

2、

xmlversion="1.0"encoding="UTF-8"?

>

EnvironmentProtection

Materialwaste

&PUBLISHER;

itmeansthewasteofsubstanceorthingsfromwhichsomethingelsecanbemade.Forexample,peoplethrowawaytheusedmetalproductsandbuyanewone,sotheoldmetalwasteaccumulates.Atlast,theybecomewaste.Forexample,whenpeoplefinishreadingnewspaper,thepaperwillbecomewaste.Whentheglassisbroken,italsobecomeswaste.Nobodywantstouseabrokenwindowordrinkwithabrokenglassorwearapairofbrokenglasses.Onceitisbroken,itbecomeswaste.Therateofusingplasticsisincreasingdaybyday.Peopleuseplasticbagsbecausetheyareconvenient.Whentheygethome,theythrowtheplasticsway,payingnoattentiontotheenvironment.Themoreconvenienceplasticsbringstous,themoreplasticwasteisproduced.Thisiscalled“whitepollution”asmostplasticsarewhite.Someofourproductsweuseeverydayaremadeofrubber,justlikethetyresandthebottompartofourshoes.It’struethatrubberplaysanimportantroleinourlife.However,italsobringsussometroublewhenithasbeenusedforalongtimeandbecomesold.Theoldtyresbecomewastebecauseitcan’tbreakdownbynature.Thisisreallyabigproblem.

Protectingtheenvironmentisnotoneperson’sduty;itdependsonallofus.Whatcanwedo?

Maybeadozen..

Inaword,usewhatcanreuseasmuchaspossible.Remember,environmentprotectionisnotone’sduty!

3、

xmlversion="1.0"encoding="UTF-8"?

>

DOCTYPENEWSPAPER[

ELEMENTNEWSPAPER(ARTICLE+)>

ELEMENTARTICLE(HEADLINE,BYLINE,LEAD,BODY,NOTES)>

ELEMENTHEADLINE(#PCDATA)>

ELEMENTBYLINE(#PCDATA)>

ELEMENTLEAD(#PCDATA)>

ELEMENTBODY(#PCDATA)>

ELEMENTNOTES(#PCDATA)>

ATTLISTARTICLEAUTHORCDATA#REQUIRED>

ATTLISTARTICLEEDITORCDATA#IMPLIED>

ATTLISTARTICLEDATECDATA#IMPLIED>

ATTLISTARTICLEEDITIONCDATA#IMPLIED>

ENTITYNEWSPAPER"VervetLogicTimes">

ENTITYPUBLISHER"VervetLogicPress">

ENTITYCOPYRIGHT"Copyright1998VervetLogicPress">

]>

EnvironmentProtection

Materialwaste

&PUBLISHER;

itmeansthewasteofsubstanceorthingsfromwhichsomethingelsecanbemade.Forexample,peoplethrowawaytheusedmetalproductsandbuyanewone,sotheoldmetalwasteaccumulates.Atlast,theybecomewaste.Forexample,whenpeoplefinishreadingnewspaper,thepaperwillbecomewaste.Whentheglassisbroken,italsobecomeswaste.Nobodywantstouseabrokenwindowordrinkwithabrokenglassorwearapairofbrokenglasses.Onceitisbroken,itbecomeswaste.Therateofusingplasticsisincreasingdaybyday.Peopleuseplasticbagsbecausetheyareconvenient.Whentheygethome,theythrowtheplasticsway,payingnoattentiontotheenvironment.Themoreconvenienceplasticsbringstous,themoreplasticwasteisproduced.Thisiscalled“whitepollution”asmostplasticsarewhite.Someofourproductsweuseeverydayaremadeofrubber,justlikethetyresandthebottompartofourshoes.It’struethatrubberplaysanimportantroleinourlife.However,italsobringsussometroublewhenithasbeenusedforalongtimeandbecomesold.Theoldtyresbecomewastebecauseitcan’tbreakdownbynature.Thisisreallyabigproblem.

Protectingtheenvironmentisnotoneperson’sduty;itdependsonallofus.Whatcanwedo?

Maybeadozen..

Inaword,usewhatcanreuseasmuchaspossible.Remember,environmentprotectionisnotone’sduty!

第四章

上机题

1、

xmlversion="1.0"encoding="UTF-8"?

>

schemaxmlns:

xs="http:

//www.w3.org/2001/XMLSchema">

elementname="Orders"type="ord"/>

complexTypename="ord">

elementname="Order">

complexType>

sequence>

elementname="name"type="xs:

string"/>

elementname="number"type="numgs"/>

elementname="city"type="xs:

string"/>

elementname="zip"type="zipgs"/>

sequence>

attributename="orderID"type="idgs"use="required"/>

attributename="orderDate"type="xs:

date"use="optional"/>

complexType>

element>

complexType>

simpleTypename=“zipgs”>

restrictionbase=“xs:

string”>

lengthvalue=“6”/>

patternvalue=“\d{6}”/>

restriction>

simpleType>

simpleTypename=“idgs”>

restrictionbase=“xs:

string”>

lengthvalue=“4”/>

patternvalue=“[A]{1}\d{3}”/>

restriction>

simpleType>

simpleTypename=“numgs”>

restrictionbase=“xs:

positiveInteger”>

maxInclusivevalue=“99”/>

minInclusicevalue=“1”/>

restriction>

simpleType>

schema>

2、

xmlversion="1.0"?

>

schemaxmlns:

xsd="http:

//www.w3.org/2001/XMLSchema">

attributename="PRODID"type="pid"/>

simpleTypename="pid">

restrictionbase="xsd:

string">

patternvalue="[P]{1}\d{3}"/>

restriction>

simpleType>

elementname="PRODUCTDATA"type="prdata"/>

complexTypename="prdata">

sequence>

elementname="PRODUCT">

complexType>

sequence>

elementname="PRODUCTNAME"type="xsd:

string"/>

elementname="DESCRIPTION"type="xsd:

string"/>

elementname="PRICE"type="xsd:

positiveInteger"/>

elementname="QUANTITY"type="xsd:

nonNegativeInteger"/>

sequence>

attributeref="PRODID"use="required">

attribute>

attributename="CATEGORY"type="cat"use="required"/>

complexType>

element>

sequence>

complexType>

si9mpleTypename="cat">

restrictionbase="xsd:

string">

enumerationvalue="Toy"/>

enumerationvalue="Book"/>

restriction>

simpleType>

schema>

3、

xmlversion="1.0"encoding="UTF-8"?

>

schemaxmlns:

xs="http:

//www.w3.org/2001/XMLSchema">

elementname="PURCHASEORDER"type="pur"/>

complexTypename="pur">

elementname="Order">

complexType>

sequence>

elementname="DATE"type="xs:

date"/>

elementname="PRODUCTNAME"type="xs:

string"/>

elementname="SUPPLIERNAME"type="xs:

string"/>

elementname="ADDRESS"type="xs:

string"/>

elementname="QUANTITY"type="xs:

positiveInteger"/>

elementname="PRICEPERQTY"type="xs:

positiveInteger"/>

sequence>

complexType>

element>

attributename="ORDERID"type="xs:

string"use="required"/>

attributename="PRODID"type="xs:

string"use="optional"/>

complexType>

schema>

第五章

上机题

1、

1)、

xmlversion="1.0"encoding="gb2312"?

>

stylesheetversion="1.0"xmlns:

xsl="http:

//www.w3.org/1999/XSL/Transform">

templatematch="/">

订单信息

订单

名称数量城市邮编

for-eachselect="/Orders/Order">

value-ofselect="name"/>

value-ofselect="number"/>

value-ofselect="city"/>

value-ofselect="zip"/>

for-each>

template>

stylesheet>

2)、

xmlversion="1.0"encoding="gb2312"?

>

stylesheetversion="1.0"xmlns:

xsl="http:

//www.w3.org/1999/XSL/Transform">

templatematch="/">

订单信息

订单

名称数量城市邮编

iftest="//Order[@orderID='A002']">

value-ofselect="name"/>

value-ofselect="number"/>

value-ofselect="city"/>

value-ofselect="zip"/>

if>

template>

stylesheet>

3)、

xmlversion="1.0"encoding="gb2312"?

>

stylesheetversion="1.0"xmlns:

xsl="http:

//www.w3.org/1999/XSL/Transform">

templatematch="/">

订单信息

订单

名称数量城市邮编

iftest="city[.='北京']">

value-ofselect="name"/>

value-ofselect="number"/>

value-ofselect="city"/>

value-ofselect="zip"/>

if>

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 外语学习 > 法语学习

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1