rspec/rules/S3844/xml/rule.adoc
Fred Tingaud 16f6c0aecf
Inline adoc when include has no additional value (#1940)
Inline adoc files when they are included exactly once.

Also fix language tags because this inlining gives us better information
on what language the code is written in.
2023-05-25 14:18:12 +02:00

51 lines
1.2 KiB
Plaintext

== Why is this an issue?
Having multiple prefixes for the same namespace is highly likely to confuse users and maintainers of the schema.
=== Noncompliant code example
[source,xml]
----
<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
[source,xml]
----
<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[]