习题:下面的XML文件写出对应于该XML文件的DTD(文档类型定义)文件
<?xmlversion="1.0"encoding="utf-8"?><purchaseOrderorderDate="2003-10-20"><!--orderDat...
<?xml version="1.0" encoding="utf-8"?>
<purchaseOrder orderDate="2003-10-20"> <!--orderDate为日期型-->
<shipTo country="US">
<name>Alice Smith</name>
<street>123 Maple Street</street>
<city>Mill Valley</city>
<state>CA</state>
<zip>90952</zip>
</shipTo> <billTo country="US"> <!--country必须出现-->
<name>Robert Smith</name>
<street>8 Oak Avenue</street>
<city>Old Town</city>
<state>PA</state>
<zip>95819</zip>
</billTo> <items> <!--item应至少出现1次-->
<item partNum="872-AA"> <!--partNum必须有--> <productName>Lawnmower</productName>
<quantity>1</quantity>
<USPrice>148.95</USPrice>
<shipDate>2003-05-21</shipDate>
</item>
<item partNum="926-AA">
<productName>Baby Monitor</productName>
<quantity>1</quantity>
<USPrice>39.98</USPrice>
<shipDate>2003-06-21</shipDate>
</item>
</items>
</purchaseOrder> 展开
<purchaseOrder orderDate="2003-10-20"> <!--orderDate为日期型-->
<shipTo country="US">
<name>Alice Smith</name>
<street>123 Maple Street</street>
<city>Mill Valley</city>
<state>CA</state>
<zip>90952</zip>
</shipTo> <billTo country="US"> <!--country必须出现-->
<name>Robert Smith</name>
<street>8 Oak Avenue</street>
<city>Old Town</city>
<state>PA</state>
<zip>95819</zip>
</billTo> <items> <!--item应至少出现1次-->
<item partNum="872-AA"> <!--partNum必须有--> <productName>Lawnmower</productName>
<quantity>1</quantity>
<USPrice>148.95</USPrice>
<shipDate>2003-05-21</shipDate>
</item>
<item partNum="926-AA">
<productName>Baby Monitor</productName>
<quantity>1</quantity>
<USPrice>39.98</USPrice>
<shipDate>2003-06-21</shipDate>
</item>
</items>
</purchaseOrder> 展开
1个回答
展开全部
很简单啊!
<!ELEMENT purchaseOrder (shipTo*,billTo+,items+)>
<!ELEMENT shipTo (name,street,city,state,zip)*>
<!ELEMENT billTo (name,street,city,state,zip)*>
<!ELEMENT items (item)*>
<!ELEMENT item (productName,quantity,USPrice,shipDate)>
<!ELEMENT name (#PCDATA)>
<!ELEMENT street (#PCDATA)>
<!ELEMENT city (#PCDATA)>
<!ELEMENT state (#PCDATA)>
<!ELEMENT zip (#PCDATA)>
<!ELEMENT productName (#PCDATA)>
<!ELEMENT quantity (#PCDATA)>
<!ELEMENT USPrice (#PCDATA)>
<!ELEMENT shipDate (#PCDATA)>
<!ATTLIST purchaseOrder orderDate CDATA #IMPLIED>
<!ATTLIST shipTo country CDATA #IMPLIED>
<!ATTLIST billTo country CDATA #REQUIRED>
已经测试了哈!
<!ELEMENT purchaseOrder (shipTo*,billTo+,items+)>
<!ELEMENT shipTo (name,street,city,state,zip)*>
<!ELEMENT billTo (name,street,city,state,zip)*>
<!ELEMENT items (item)*>
<!ELEMENT item (productName,quantity,USPrice,shipDate)>
<!ELEMENT name (#PCDATA)>
<!ELEMENT street (#PCDATA)>
<!ELEMENT city (#PCDATA)>
<!ELEMENT state (#PCDATA)>
<!ELEMENT zip (#PCDATA)>
<!ELEMENT productName (#PCDATA)>
<!ELEMENT quantity (#PCDATA)>
<!ELEMENT USPrice (#PCDATA)>
<!ELEMENT shipDate (#PCDATA)>
<!ATTLIST purchaseOrder orderDate CDATA #IMPLIED>
<!ATTLIST shipTo country CDATA #IMPLIED>
<!ATTLIST billTo country CDATA #REQUIRED>
已经测试了哈!
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |