I have a pretty standard xml schema defining an element called "part" that should repeat.
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="part">
<xs:complexType>
<xs:sequence>
<xs:element name="part_number" type="xs:string"/>
<xs:element name="price" type="xs:decimal"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
problem is, when I use this schema to export a price list I get this:
<?XML version="1.0" encoding="UTF-8" standalone="yes"?>
<part>
<part_number>10-000</part_number>
<price>151.8</price>
</part>
When I want mulitple <part>
elements. Where am I messing up in the schema?
<xs:element name="parts">
<xs:complexType>
<xs:sequence>
<xs:element name="part" maxOccurs="unbounded" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element name="part_number" type="xs:string"/>
<xs:element name="price" type="xs:decimal"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
您的元素需要maxOccurs =“ unbounded”,因为maxOccurs的默认值为1。
<xs:element name="part" maxOccurs="unbounded">
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.