HomeXML Page 4 - Doing More With XML Schemas (part 4)
Setting Policy - XML
In this concluding article, find out all about namespaces - what they are, how they work, and how you can use schemas to make sure that they're enforced in a consistent manner.
You can tell the validator to ensure that every element in the XML document instance is qualified with a namespace via the "elementFormDefault" attribute of the <xsd:schema> element.
This "elementFormDefault" attribute tells the validator that every element in
the document instance must be qualified with a namespace identifier in order for the document to be valid. In order to verify this, you can try removing the namespace prefix from one of the <character> elements in the document instance above and validating the XML data - your validator should throw up a bunch of error messages about improperly-qualified elements.
Document authors can also satisfy this qualification requirement by specifying a default namespace for all the elements in the document instance - as in the following code segment.
If you don't necessarily want to force the document author to prefix the namespace
identifier to every element in each document instance, you can turn off this requirement by specifying a value of "unqualified" for the "elementFormDefault" attribute.