Reputation: 447
I would like to know if it is valid (I assume so) to have a sequence within a sequence and if so, what would be the (intended) benefit from this.
The reason I'm asking is that I'm currently try to setup an interface that outputs a tax file specific to Poland. For those interested, here's the full XSD, however I just refer to the "interesting" parts here:
<xsd:complexType>
<xsd:sequence>
<xsd:element name="LpSprzedazy" type="tns:TNaturalnyJPK">
<xsd:annotation>
<xsd:documentation>Lp. wiersza ewidencji sprzedaży VAT</xsd:documentation>
</xsd:annotation>
</xsd:element>
<!-- lots of other elements -->
<xsd:element name="K_14" type="tns:TKwotowy" minOccurs="0">
<xsd:annotation>
<xsd:documentation>Kwota netto - w tym dostawa towarów, o której mowa w art. 129 ustawy</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:sequence minOccurs="0">
<xsd:element name="K_15" type="tns:TKwotowy">
<xsd:annotation>
<xsd:documentation>Kwota netto - Dostawa towarów oraz świadczenie usług na terytorium kraju, opodatkowane stawką 5%</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="K_16" type="tns:TKwotowy">
<xsd:annotation>
<xsd:documentation>Kwota podatku należnego - Dostawa towarów oraz świadczenie usług na terytorium kraju, opodatkowane stawką 5%</xsd:documentation>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
<!-- two other sequences like the one for "K_15" and "K_16" above-->
<xsd:element name="K_21" type="tns:TKwotowy" minOccurs="0">
<xsd:annotation>
<xsd:documentation>Kwota netto - Wewnątrzwspólnotowa dostawa towarów</xsd:documentation>
</xsd:annotation>
</xsd:element>
<!-- lots of other elements -->
</xsd:sequence>
<xsd:attribute name="typ" use="required" fixed="G"/>
</xsd:complexType>
My question are:
K_15
and K_16
as an sequence. Is it because it would be allowed to omit both but not individually?Upvotes: 1
Views: 597
Reputation: 111688
xsd:sequence
elements can be nested in XSD.K_15
and K_16
in your shown XSD are collectively optional
due to the minOccurs="0"
on the parent xsd:sequence
.Another useful subsequence pattern is when maxOccurs
is greater than 1, indicating that the subsequence of elements may repeat together.
Upvotes: 2