有什么方法可以从这个 XML 制作 XML Schema 1.0?
<products>
<product category="ABCD"> <!-- Mandatory element -->
<name> PC </name> <!-- mandatory element -->
<costs>-10000.00</costs> <!--mandatory element -->
<price>110000.00</price> <!-- mandatory element -->
</product>
<product category="ABCDSetup">
<description> Skladanie PC</description> <!-- mandatory element -->
<price>10000.00</price> <!-- Price of the service, either price or costs must be included -->
</product>
</products>
我有这个但它错了,因为如果标签<name>
出现,标签<costs>
和<price>
两者都必须出现
<xsd:sequence>
<xsd:choice>
<xsd:element name="name">...</xsd:element>
<xsd:element name="description">...</xsd:element>
</xsd:choice>
<xsd:choice minOccurs="1" maxOccurs="2">
<xsd:element name="price">...</xsd:element>
<xsd:element name="costs">...</xsd:element>
</xsd:choice>
</xsd:sequence>