rspec/rules/S3850/xml/rule.adoc
2022-02-04 16:28:24 +00:00

39 lines
1.3 KiB
Plaintext

``++xs:any++`` and ``++xs:anyAttribute++`` are wildcards; they allow the XML document author to use any element or attribute. By specifying ``++nameSpace++``s for them, you can restrict what's used to elements in the specified name spaces. By default, what's used for ``++xs:any++`` and ``++xs:anyAttribute++`` will be validated in a strict manner (``++processContents="strict"++``). That is, validation will fail if the element used isn't recognized. That makes sense if you've provided a namespace, but not if you haven't. Conversely, ``++processContents="lax"++`` allows unrecognized elements to pass validation even if they're not recognized. That makes sense if no namespace has been specified, but not if one has been specified.
This rule raises an issue when ``++strict++`` processing is used (either explicitly or implicitly) when no namespace is provided, and conversely when ``++lax++`` processing is used with a namespace.
== Noncompliant Code Example
[source,xml]
----
ToDo
----
== Compliant Solution
[source,xml]
----
ToDo
----
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
include::message.adoc[]
include::highlighting.adoc[]
'''
== Comments And Links
(visible only on this page)
include::comments-and-links.adoc[]
endif::env-github,rspecator-view[]