1
對於以下xml需要架構。xml具有不同值的相同元素需要架構
<?xml version="1.0" encoding="UTF-8"?>
<overall_operation>
<operation type="list_products">
<ops_description>Listing all the products of a company</ops_description>
<module>powesystem</module>
<comp_name>APC</comp_name>
<prod_price>50K$</prod_price>
<manf_date>2001</manf_date>
<pool_name>Electrical</pool_name>
<fail_retry>2</fail_retry>
<storage_type>avialble</storage_type>
<storage_check>false</storage_check>
<api_type>sync</api_type>
<product_name>transformer</product_name>
</operation>
<operation type="search_product">
<ops_description>Search the products of a company from the repository</ops_description>
<module>high-voltage</module>
<module>powesystem</module>
<comp_name>APC</comp_name>
<pool_name>Electrical</pool_name>
<fail_retry>2</fail_retry>
<storage_type>avialble</storage_type>
<storage_check>false</storage_check>
<api_type>sync</api_type>
<product_name>setup-transformer</product_name>
</operation>
</overall_operation>
這裏不同元件與操作等list_products
,search_products
等。 每個元素都有一些常見的屬性,如ops_description
,module
等等。
另外一些對每個元素如prod_price
,manf_date
等
獨特屬性的我想有一個XML模式來驗證。一些屬性也是可選的。
我試着使用抽象和派生,但無法使其工作。
您是否想爲給定的操作類型定義一組固定的子元素?例如:如果`type =「list_products」`然後``是必需的。 –
Filburt
2011-02-18 15:17:31