a dating website - Validating xml without namespace


Document Builder Factory factory = Document Builder Instance() // ...

validating xml without namespace-4

Well, this doesn’t work, because the xsi:schema Location attribute expects an xml namespace. I could invent a namespace, but that would actually mean changing the data AND changing the schema definition before validating it.

This is not an option (although if xml would have been unerstood entirely by the developers of the system providing the data, it would already be there).

That is, there was no target Namespace attribute with the xs:schema element in the XSDs.

From the standard The lack of a namespace is legal and is used to support an XSD authoring technique called "Chameleon Namespace Design".

The data set may include information from a tax declaration form as well as information from the employee's hiring form, with both elements named Note - The default namespace is actually a specific namespace.