XML课本程序代码第四章例题.docx

上传人:b****7 文档编号:23716663 上传时间:2023-05-20 格式:DOCX 页数:18 大小:169.25KB
下载 相关 举报
XML课本程序代码第四章例题.docx_第1页
第1页 / 共18页
XML课本程序代码第四章例题.docx_第2页
第2页 / 共18页
XML课本程序代码第四章例题.docx_第3页
第3页 / 共18页
XML课本程序代码第四章例题.docx_第4页
第4页 / 共18页
XML课本程序代码第四章例题.docx_第5页
第5页 / 共18页
点击查看更多>>
下载资源
资源描述

XML课本程序代码第四章例题.docx

《XML课本程序代码第四章例题.docx》由会员分享,可在线阅读,更多相关《XML课本程序代码第四章例题.docx(18页珍藏版)》请在冰豆网上搜索。

XML课本程序代码第四章例题.docx

XML课本程序代码第四章例题

4_1.XML

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

>

--NewdocumentcreatedwithEditiXatThuMar2211:

37:

13CST2012-->

DOCTYPEorderSYSTEM"order.dtd">

12345678

105.99

Visa

4111*******1111

02-03-2009

JonhSmith

416-555-1234

5050MapleStreet

Toronto

Ontario

Canada

TheordersystemisforCanadiancustomersonly.

order.dtd

ELEMENTorder(order_id,amount,credit_card,date,customer,shipping_addr,comment)>

ELEMENTorder_id(#PCDATA)>

ELEMENTamount(#PCDATA)>

ELEMENTcredit_card(card_type,card_num)>

ELEMENTcard_type(#PCDATA)>

ELEMENTcard_num(#PCDATA)>

ELEMENTdate(#PCDATA)>

ELEMENTcustomer(name,phone)>

ELEMENTname(#PCDATA)>

ELEMENTphone(#PCDATA)>

ELEMENTshipping_addr(street,city,province,country)>

ELEMENTstreet(#PCDATA)>

ELEMENTcity(#PCDATA)>

ELEMENTprovince(#PCDATA)>

ELEMENTcountry(#PCDATA)>

ELEMENTcomment(#PCDATA)>

ATTLISTphonephone_type(home|work|mobile)#REQUIRED>

4_4.XML

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

>

xmlns:

xsi="http:

//www.w3.org/2001/XMLSchema-instance"

xsi:

noNamespaceSchemaLocation="country.xsd">

Canada

China

UnitedStates

country.xsd

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

>

--NewdocumentcreatedwithEditiXatThuMar2211:

44:

46CST2012-->

schemaxmlns:

xs="http:

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

elementname="countries">

complexType>

sequence>

elementname="country"type="xs:

string"minOccurs="1"maxOccurs="unbounded"/>

sequence>

complexType>

element>

schema>

4_5.XML

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

>

xsi="htpp:

//www.w3.org/2001/XMLSchema-instance"

xsi:

noNamespaceSchemaLocation="olympic.xsd">

olympic.xsd

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

>

schemaxmlns:

xs="http:

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

elementname="olympic">

complexType>

sequence>

elementmaxOccurs="unbounded"minOccurs="1"name="results">

complexType>

sequence>

elementmaxOccurs="unbounded"minOccurs="1"ref="country"/>

sequence>

attributeGroupref="results_attributes"/>

complexType>

element>

sequence>www.wetherm-

complexType>

element>

elementname="country">

complexType>

attributeGroupref="country_attributes"/>

complexType>

element>

attributeGroupname="results_attributes">

attributename="city"type="xs:

string"use="required"/>

attributename="year"type="xs:

integer"use="required"/>

attributeGroup>

attributeGroupname="country_attributes">

attributename="gold"type="xs:

integer"use="required"/>

attributename="rank"type="xs:

integer"use="required"/>

attributename="name"type="xs:

string"use="required"/>

attributename="code"type="xs:

string"use="required"/>

attributeGroup>

schema>

4_8.XML

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

>

countries

xmlns:

xsi="htpp:

//www.w3.org/2001/XMLSchema-instance"

xmlns:

c="http:

//javabeans.mobi/xml/demos"

xsi:

schemaLocation="http:

//javabeans.mobi/xml/demoscountry_ns.xsd">

Canada温碧泉

China

UnitedStates

countries>

country_ns.xsd

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

>

schematargetNamespace="http:

//javabeans.mobi/xml/demos"xmlns:

xs="http:

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

elementname="countries">

complexType>

sequence>

elementmaxOccurs="unbounded"minOccurs="1"name="country"type="xs:

string"/>

sequence>

complexType>

element>

schema>

4_10

Olympic_ns_wrong.xsd

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

>

schemaxmlns:

xs="http:

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

targetNamespace="http:

//javabeans.mobi/xml/demos">

elementname="olympic">

complexType>

sequence>

elementmaxOccurs="unbounded"minOccurs="1"name="results">

complexType>

sequence>

elementmaxOccurs="unbounded"minOccurs="1"ref="country"/>

sequence>

attributeGroupref="results_attributes"/>

--引用的是一个不具有名称空间的组件!

-->

complexType>

element>

sequence>

complexType>

element>

elementname="country">

complexType>

attributeGroupref="country_attributes"/>

--引用的是一个不具有名称空间的组件!

-->

complexType>

element>

attributeGroupname="results_attributes">

attributename="city"type="xs:

string"use="required"/>

attributename="year"type="xs:

integer"use="required"/>

attributeGroup>

attributeGroupname="country_attributes">

attributename="gold"type="xs:

integer"use="required"/>

attributename="rank"type="xs:

integer"use="required"/>

attributename="name"type="xs:

string"use="required"/>

attributename="code"type="xs:

string"use="required"/>

attributeGroup>

schema>

4_11

Olympic_ns.xsd

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

>

schemaxmlns:

xs="http:

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

xmlns:

c="http:

//javabeans.mobi/xml/demos"

targetNamespace="http:

//javabeans.mobi/xml/demos">

elementname="olympic">

complexType>

sequence>

elementmaxOccurs="unbounded"minOccurs="1"name="results">

complexType>

sequence>

elementmaxOccurs="unbounded"minOccurs="1"ref="c:

country"/>

sequence>

attributeGroupref="c:

results_attributes"/>

complexType>

element>

sequence>

complexType>

element>

elementname="country">

complexType>

attributeGroupref="c:

country_attributes"/>

complexType>

element>

attributeGroupname="results_attributes">

attributename="city"type="xs:

string"use="required"/>

attributename="year"type="xs:

integer"use="required"/>

attributeGroup>

attributeGroupname="country_attributes">

attributename="gold"type="xs:

integer"use="required"/>

attributename="rank"type="xs:

integer"use="required"/>

attributename="name"type="xs:

string"use="required"/>

attributename="code"type="xs:

string"use="required"/>

attributeGroup>

schema>

4_12.xsd

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

>

schemaxmlns:

xs="http:

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

elementname="olympic">

complexType>

sequence>

elementmaxOccurs="unbounded"minOccurs="1"name="results">

complexType>

sequence>

elementmaxOccurs="unbounded"minOccurs="1"ref="country"/>

sequence>

attributeGroupref="results_attributes"/>

complexType>

element>

sequence>

complexType>

element>

elementname="country">

complexType>

attributename="gold"type="xs:

integer"use="required"/>

attributename="rank"type="xs:

integer"use="required"/>

attributename="name"type="xs:

string"use="required"/>

attributename="code"type="xs:

string"use="required"/>

complexType>

element>

attributeGroupname="results_attributes">

attributename="city"type="xs:

string"use="required"/>

attributename="year"type="xs:

integer"use="required"/>

attributeGroup>

schema>

4_13.XML

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

>

xmlns:

xsi="http:

//www.w3.org/2001/XMLSchema-instance"

xsi:

noNamespaceSchemaLocation="4_13.xsd">

12345678

105.99

Visa

4111*******1111

02-03-2009

JonhSmith

416-555-1234

5050MapleStreet

Toronto

Ontario

Canada

TheordersystemisforCanadiancustomersonly.

4_13.xsd

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

>

schemaxmlns:

xs="http:

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

elementname="order">

complexType>

sequence>

elementname="order_id"type="xs:

string"/>

elementname="amount"type="xs:

string"/>

elementref="credit_card"/>

elementname="date"type="xs:

string"/>

elementref="customer"/>

elementref="shipping_addr"/>

elementname="comment"type="xs:

string"/>

sequence>

complexType>

element>

complexTypename="credit_card_type">

sequence>

elementname="card_type"type="xs:

string"/>

elementname="card_num"type="xs:

string"/>

sequence>

complexType>

elementname="credit_card"type="credit_card_type"/>

complexTypename="customer">

sequence>

elementname="name"type="xs

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

当前位置:首页 > 农林牧渔 > 畜牧兽医

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

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