I have this code in XML Schema:
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.example.org/dataset"
xmlns:tns="http://www.example.org/dataset" >
<!-- como poner que un tipo complejo pueda repetirse -->
<xsd:complexType name="tDataset">
<xsd:sequence>
<!-- poner lo de la cursiva y todo eso -->
<xsd:element name = "descripcion" type = "xsd:string" minOccurs = '1'/>
<xsd:element name = "acceso" minOccurs = '1' maxOccurs = 'unbounded'/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
And I want to define that a complex type element can repeat between 1 and N times. That complex type that I want to repeat is the one called tDataset
and I don't know how to do that.
This element declaration,
<xsd:element name="e" type="tDataset" minOccurs="1" maxOccurs="2"/>
says that e
is of complex type, tDataset
, and may appear 1 to N=2
times.
Notes:
N
you mean an unlimited number, use maxOccurs="unbounded"
. N
you mean a number dependent upon some derived value, you'll need XSD 1.1's assertion mechanism. minOccurs
nor maxOccurs
may occur on an element declared at the root level because an XML document can only have a single root element.
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.