XML课本程序代码第四章例题.docx
- 文档编号:23716663
- 上传时间:2023-05-20
- 格式:DOCX
- 页数:18
- 大小:169.25KB
XML课本程序代码第四章例题.docx
《XML课本程序代码第四章例题.docx》由会员分享,可在线阅读,更多相关《XML课本程序代码第四章例题.docx(18页珍藏版)》请在冰豆网上搜索。
XML课本程序代码第四章例题
4_1.XML
xmlversion="1.0"encoding="UTF-8"?
>
--NewdocumentcreatedwithEditiXatThuMar2211:
37:
13CST2012-->
DOCTYPEorderSYSTEM"order.dtd">
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">
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"> 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"> 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
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- XML 课本 程序代码 第四 例题