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