rspec/rules/S3851/xml/rule.adoc

27 lines
883 B
Plaintext
Raw Normal View History

2021-04-28 16:49:39 +02:00
The ``++<xs:all>++`` group element isn't supported universally among web service stacks. That means that if you use it, you may end up failing to transmit your data (in the resulting XML files) to systems that can't process it. For that reason, ``++<xs:sequence>++`` should be used instead. The only constraint imposed by the use of an ``++<xs:sequence>++`` is the order it imposes, but that is usually a benefit for human readers.
2021-04-28 16:49:39 +02:00
== Noncompliant Code Example
----
<xs:complexType name="fruitType">
<xs:all> <!-- Noncompliant -->
<xs:element name="name" type="xs:string"/>
<xs:element name="color" type="xs:string"/>
</xs:all>
</xs:complexType>
----
2021-04-28 16:49:39 +02:00
== Compliant Solution
----
<xs:complexType name="fruitType">
<xs:sequence>
<xs:element name="name" type="xs:string"/>
<xs:element name="color" type="xs:string"/>
</xs:sequence>
</xs:complexType>
----