rspec/rules/S3839/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

43 lines
986 B
Plaintext

== Why is this an issue?
The use of a ``++targetNamespace++`` in an XSD means that all the elements described in the XSD are restricted to that namespace, rather than landing in the global namespace. This provides clarity, and makes the schema easier to use in concert with other schemas that might define elements with the same names.
=== Noncompliant code example
[source,xml]
----
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified" version="1"> <!-- Noncompliant -->
...
----
=== Compliant solution
[source,xml]
----
<xs:schema targetNamespace="http://www.codeSamples.com/fruit"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified" version="1">
...
----
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
=== Message
Add a "targetNamespace" to this schema.
=== Highlighting
``++xs:schema++``
endif::env-github,rspecator-view[]