For instance, is the following XML document considered valid as per the W3C XML 1.0 recommendation? Notice that the namespace ‘future’ is not referenced anywhere in the document.
Although this may not be considered good style, my belief is that the document is still valid regardless of the unused namespace. Can anyone confirm or refute this assumption?
Thanks, Matt
<?xml version="1.0" encoding="UTF-8" ?>
<root xmlns='http://foo.org/v1' xmlns:future='http://bar.org/v1'>
<child>1</child>
</root>
The standard does not seem to indicate otherwise. Section 7, “Conformance of Documents” gives a few requirements in order to call a document “namespace-well-formed” and “namespace-valid” but nothing says that you can’t have an unused namespace declaration.
In section 3, an example is given, which contains an unused namespace: