XML格式解读

    1. <?xml version="1.0" encoding="UTF-8" ?>
    2. <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
    3. <!-- 简易元素的定义 -->
    4. <xs:element name="Initialtime" type="xs:decimal"/>
    5. <xs:element name="Finaltime" type="xs:decimal"/>
    6. <xs:element name="Timestep" type="xs:decimal"/>
    7. <xs:element name="TimeUnits" type="xs:string"/>
    8. <xs:element name="max" type="xs:decimal"/>
    9. <xs:element name="min" type="xs:decimal"/>
    10. <xs:element name="equation" type="xs:string"/>
    11. <xs:element name="initialvalue" type="xs:string"/>
    12. <xs:element name="increment" type="xs:decimal"/>
    13. <xs:element name="value" type="xs:decimal"/>
    14. <xs:element name="name">
    15. <xs:simpleType>
    16. <xs:restriction base="xs:string">
    17. <xs:pattern value="[^ ]*"/>
    18. </xs:restriction>
    19. </xs:simpleType>
    20. </xs:element>
    21. <xs:element name="unit">
    22. <xs:simpleType>
    23. <xs:restriction base="xs:string">
    24. <xs:pattern value="[^ ]*"/>
    25. </xs:restriction>
    26. </xs:simpleType>
    27. </xs:element>
    28. <!-- 属性的定义 -->
    29. <xs:attribute name="id" type="xs:integer"/>
    30. <!-- 复合元素的定义 -->
    31. <xs:element name="predecessor">
    32. <xs:complexType>
    33. <xs:attribute ref="id" use="required"/>
    34. </xs:complexType>
    35. </xs:element>
    36. <xs:element name="succeed">
    37. <xs:complexType>
    38. <xs:attribute ref="id" use="required"/>
    39. </xs:complexType>
    40. </xs:element>
    41. <xs:element name="predecessors">
    42. <xs:complexType>
    43. <xs:sequence>
    44. <xs:element ref="predecessor" maxOccurs="unbounded" minOccurs="0"/>
    45. </xs:sequence>
    46. </xs:complexType>
    47. </xs:element>
    48. <xs:element name="succeeds">
    49. <xs:complexType>
    50. <xs:sequence>
    51. <xs:element ref="succeed" maxOccurs="unbounded" minOccurs="0"/>
    52. </xs:sequence>
    53. </xs:complexType>
    54. </xs:element>
    55. <!--
    56. int id; // *必有
    57. Component_Type type;// *必有
    58. String name;// *必有
    59. String equation;// *必有
    60. String unit;
    61. Vector<Float> hist_value;
    62. float Max;
    63. float Min;
    64. List<Integer> predecessor;
    65. List<Integer> succeed;
    66. String initialvalue;// *必有 -->
    67. <xs:element name="Stock">
    68. <xs:complexType>
    69. <xs:all>
    70. <xs:element ref="name" />
    71. <xs:element ref="equation" />
    72. <xs:element ref="unit" minOccurs="0"/>
    73. <xs:element ref="max" minOccurs="0"/>
    74. <xs:element ref="min" minOccurs="0"/>
    75. <xs:element ref="predecessors" minOccurs="0"/>
    76. <xs:element ref="succeeds" minOccurs="0"/>
    77. <xs:element ref="initialvalue" />
    78. </xs:all>
    79. <xs:attribute ref="id" use="required"/>
    80. </xs:complexType>
    81. </xs:element>
    82. <xs:element name="Stocks">
    83. <xs:complexType>
    84. <xs:sequence>
    85. <xs:element ref="Stock" maxOccurs="unbounded"/>
    86. </xs:sequence>
    87. </xs:complexType>
    88. </xs:element>
    89. <!--
    90. int id; // *必有
    91. Component_Type type;// *必有
    92. String name;// *必有
    93. String equation;// *必有
    94. String unit;
    95. Vector<Float> hist_value;
    96. float Max;
    97. float Min;
    98. List<Integer> predecessor;
    99. List<Integer> succeed;
    100. float value; //可能是不需要的 -->
    101. <xs:element name="Rate">
    102. <xs:complexType>
    103. <xs:all>
    104. <xs:element ref="name" />
    105. <xs:element ref="equation" />
    106. <xs:element ref="unit" minOccurs="0"/>
    107. <xs:element ref="max" minOccurs="0"/>
    108. <xs:element ref="min" minOccurs="0"/>
    109. <xs:element ref="predecessors" minOccurs="0"/>
    110. <xs:element ref="succeeds" minOccurs="0"/>
    111. <xs:element ref="value" minOccurs="0"/>
    112. </xs:all>
    113. <xs:attribute ref="id" use="required"/>
    114. </xs:complexType>
    115. </xs:element>
    116. <xs:element name="Rates">
    117. <xs:complexType>
    118. <xs:sequence>
    119. <xs:element ref="Rate" maxOccurs="unbounded" minOccurs="0"/>
    120. </xs:sequence>
    121. </xs:complexType>
    122. </xs:element>
    123. <!--
    124. int id; // *必有
    125. Component_Type type;// *必有
    126. String name;// *必有
    127. String equation;// *必有
    128. String unit;
    129. Vector<Float> hist_value;
    130. float Max;
    131. float Min;
    132. List<Integer> predecessor;
    133. List<Integer> succeed;
    134. float Increment;
    135. float value; //可能是不需要的 -->
    136. <xs:element name="Variable">
    137. <xs:complexType>
    138. <xs:all>
    139. <xs:element ref="name" />
    140. <xs:element ref="equation" />
    141. <xs:element ref="unit" minOccurs="0"/>
    142. <xs:element ref="max" minOccurs="0"/>
    143. <xs:element ref="min" minOccurs="0"/>
    144. <xs:element ref="predecessors" minOccurs="0"/>
    145. <xs:element ref="succeeds" minOccurs="0"/>
    146. <xs:element ref="increment" minOccurs="0"/>
    147. <xs:element ref="value" minOccurs="0"/>
    148. </xs:all>
    149. <xs:attribute ref="id" use="required"/>
    150. </xs:complexType>
    151. </xs:element>
    152. <xs:element name="Variables">
    153. <xs:complexType>
    154. <xs:sequence>
    155. <xs:element ref="Variable" maxOccurs="unbounded" minOccurs="0"/>
    156. </xs:sequence>
    157. </xs:complexType>
    158. </xs:element>
    159. <xs:element name="setup">
    160. <xs:complexType>
    161. <xs:sequence>
    162. <xs:element ref="Stocks" maxOccurs="1"/>
    163. <xs:element ref="Rates" maxOccurs="1" minOccurs="0"/>
    164. <xs:element ref="Variables" maxOccurs="1" minOccurs="0"/>
    165. </xs:sequence>
    166. </xs:complexType>
    167. </xs:element>
    168. <xs:element name="execute">
    169. <xs:complexType>
    170. <xs:all>
    171. <xs:element ref="Initialtime"/>
    172. <xs:element ref="Finaltime"/>
    173. <xs:element ref="Timestep"/>
    174. <xs:element ref="TimeUnits" minOccurs="0"/>
    175. </xs:all>
    176. </xs:complexType>
    177. </xs:element>
    178. <xs:element name="simulation">
    179. <xs:complexType>
    180. <xs:all>
    181. <xs:element ref="execute"/>
    182. <xs:element ref="setup"/>
    183. </xs:all>
    184. </xs:complexType>
    185. </xs:element>
    186. </xs:schema>