Validating xml without namespace

12-Aug-2018 02:33

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

This technique allows -- through an xs:include directive -- another schema to absorb the elements and types into another namespace.

Instead of defining a different namespace in each XSD, all XSDs are brought under a single namespace.

This post describes the background of the Chameleon technique.

It is not mandatory to declare namespaces only at the root element; rather it could be declared at any element in the XML document.

However, Xerces didn't really like that, because of the way schema support is implemented.It is not valid, however, because the instance document uses universal names only for the kbs:my Root element, but not for child1 or child2.That conflicts with the DTD, which indicates that the content of kbs:my Root is kbs:child1 followed by one or more kbs:child2 elements, not child1 and child2.One of the primary motivations for defining an XML namespace is to avoid naming conflicts when using and re-using multiple vocabularies.