rspec/rules/S3844/xml/rule.adoc

51 lines
1.2 KiB
Plaintext
Raw Permalink Normal View History

== Why is this an issue?
2021-04-28 16:49:39 +02:00
Having multiple prefixes for the same namespace is highly likely to confuse users and maintainers of the schema.
=== Noncompliant code example
2021-04-28 16:49:39 +02:00
2022-02-04 17:28:24 +01:00
[source,xml]
2021-04-28 16:49:39 +02:00
----
<xs:schema targetNamespace="http://www.codeSamples.com/fruit"
elementFormDefault="qualified" version="1"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:animal="http://www.codeSamples.com/animal"
xmlns:beast="http://www.codeSamples.com/animal"> <!-- Noncompliant -->
...
</xs:schema>
----
=== Compliant solution
2021-04-28 16:49:39 +02:00
2022-02-04 17:28:24 +01:00
[source,xml]
2021-04-28 16:49:39 +02:00
----
<xs:schema targetNamespace="http://www.codeSamples.com/fruit"
elementFormDefault="qualified" version="1"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:animal="http://www.codeSamples.com/animal">
...
</xs:schema>
----
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
=== Message
Remove this redundant namespace listing; this namespace has already been assigned the prefix "xxx".
=== Highlighting
Primary: ``++xmlns:xxx=yyy"++``
Secondary: inital definition/prefix assignment
endif::env-github,rspecator-view[]