rspec/rules/S3851/xml/rule.adoc

40 lines
1.1 KiB
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
2022-02-04 17:28:24 +01:00
[source,xml]
2021-04-28 16:49:39 +02:00
----
<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
2022-02-04 17:28:24 +01:00
[source,xml]
2021-04-28 16:49:39 +02:00
----
<xs:complexType name="fruitType">
<xs:sequence>
<xs:element name="name" type="xs:string"/>
<xs:element name="color" type="xs:string"/>
</xs:sequence>
</xs:complexType>
----
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
include::message.adoc[]
include::highlighting.adoc[]
endif::env-github,rspecator-view[]