Reputation: 316
We have a customer who is supplying XML documents whose content doesn't have a namespace. We are trying to validate those documents against an official schema that has been assigned a namespace.
1) Are the XML documents supplied by the customer valid?
2) Would it be technically incorrect to try to validate the XML document against the XSD?
Upvotes: 1
Views: 189
Reputation: 21658
Short answers:
1) No - at least ccording to the XSD you refer to.
2) No. You can try to validate any XSD against any XML.
While my answers may sound too "strictly speaking", keep in mind that validation is intended to provide an indication of conformance; it is expected, therefore acceptable/technically correct, to match any XML with any XSD.
You may read here on SO that a valid scenario is to apply a transformation of some sort against the XML that may compensate for missing things. E.g.: if the issue consists of a missing namespace declaration, and any attempt to convince the producer of the XML to correct deficiencies has failed, then run it through an XSLT to bring it up to the required format, then apply the XSD.
To me this is an idea that should be considered cautiously: running XSLT against every XML is an overhead that many cannot afford in high volume numbers. My opinion: it is way better to simply adapt your XSD, to account for what's needed to workaround. This approach would result in no runtime overhead, with less design time/maintenance efforts than dealing with XSLT...
Upvotes: 1