永发信息网

怎么样根据xsd文件写出xml文档?

答案:1  悬赏:70  手机版
解决时间 2021-05-10 18:46
  • 提问者网友:泪痣哥哥
  • 2021-05-10 13:27

<?xml version="1.0"?>
<xs:schema xmlns:xs=" http://www.w3.org/2001/XMLSchema">
 <xs:element name="ancient_wonders">
  <xs:complexType>
   <xs:sequence>
    <xs:element name="wonder" type="wonderType" maxOccurs="unbounded"/>
   </xs:sequence>
  </xs:complexType>
 </xs:element>
 <xs:complexType name="wonderType">
  <xs:sequence>
   <xs:element name="name" type="nameType" maxOccurs="unbounded"/>
   <xs:element name="location" type="xs:string"/>
   <xs:element name="height" type="heightType"/>
   <xs:element name="history" type="historyType"/>
   <xs:element name="main_image" type="imageType"/>
   <xs:element name="source" type="sourceType" minOccurs="0" maxOccurs="unbounded"/>
  </xs:sequence>
 </xs:complexType>
 <xs:complexType name="nameType">
  <xs:simpleContent>
   <xs:extension base="xs:string">
    <xs:attribute name="language" type="xs:string" use="required"/>
   </xs:extension>
  </xs:simpleContent>
 </xs:complexType>
 <xs:complexType name="heightType">
  <xs:simpleContent>
   <xs:extension base="xs:nonNegativeInteger">
    <xs:attribute name="units" type="xs:string" use="required"/>
   </xs:extension>
  </xs:simpleContent>
 </xs:complexType>
 <xs:complexType name="historyType">
  <xs:sequence>
   <xs:element name="year_built" type="yearType"/>
   <xs:element name="year_destroyed" type="yearType" minOccurs="0"/>
   <xs:element name="how_destroyed" type="destrType" minOccurs="0"/>
   <xs:element name="story" type="storyType"/>
  </xs:sequence>
 </xs:complexType>
 <xs:complexType name="yearType">
  <xs:simpleContent>
   <xs:extension base="xs:positiveInteger">
    <xs:attribute name="era" type="xs:string" use="required"/>
   </xs:extension>
  </xs:simpleContent>
 </xs:complexType>
 <xs:simpleType name="destrType">
  <xs:restriction base="xs:string">
   <xs:enumeration value="earthquake"/>
   <xs:enumeration value="fire"/>
  </xs:restriction>
 </xs:simpleType>
 <xs:complexType name="storyType" mixed="true">
  <xs:sequence>
   <xs:element name="para" minOccurs="0" maxOccurs="unbounded">
    <xs:complexType/>
   </xs:element>
  </xs:sequence>
 </xs:complexType>
 <xs:complexType name="imageType">
  <xs:attribute name="file" type="xs:anyURI" use="required"/>
  <xs:attribute name="w" type="xs:positiveInteger" use="required"/>
  <xs:attribute name="h" type="xs:positiveInteger" use="required"/>
 </xs:complexType>
 <xs:complexType name="sourceType">
  <xs:attribute name="sectionid" type="xs:positiveInteger" use="required"/>
  <xs:attribute name="newspaperid" type="xs:positiveInteger" use="required"/>
 </xs:complexType>
</xs:schema>

 

这个是xsd文件 我想写个xml文档出来

 

那位大虾帮下忙?

 

用什么软件可以直接生成不?》

最佳答案
  • 五星知识达人网友:人類模型
  • 2021-05-10 14:44
<?xml version="1.0" encoding="UTF-8"?><!ELEMENT USPrice (CDATA)><!ELEMENT billTo (name, street, city, state, zip)><!ATTLIST billTo country CDATA #REQUIRED><!ELEMENT city (CDATA)><!ELEMENT item (productName, quantity, USPrice, shipDate)><!ATTLIST item partNum (872-AA | 926-AA) #REQUIRED><!ELEMENT items (item+)><!ELEMENT name (CDATA)><!ELEMENT productName (CDATA)><!ELEMENT purchaseOrder (shipTo, billTo, items)><!ATTLIST purchaseOrder orderDate CDATA #REQUIRED><!ELEMENT quantity (CDATA)><!ELEMENT shipDate (CDATA)><!ELEMENT shipTo (name, street, city, state, zip)><!ATTLIST shipTo country CDATA #REQUIRED><!ELEMENT state (CDATA)><!ELEMENT street (CDATA)><!ELEMENT zip (CDATA)>
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯