As I researched and wrote schema’s I realized I was writing
<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" >
What was wrong with that you might be asking? Well for starters I had no idea what the attribute elementFormDefault did. I had been writing it over and over without knowing what it did just that it worked, this was just asking for trouble. So I did some research and more research. It finally all came together and I figured I would share my findings for everyone to enjoy.
elementFormDefault is an attribute of the schema tag. It is used, in a way, with the targetNamespace attribute of that schema tag. The targetNamespace attribute does what it sounds like it does, it specifies the location of the namespace being used. The two values for elementFormDefault attribute, qualifed and unqualified. Depending on the value of elementFormDefault, the namespace will either be used for all of the elements in the XML document or it will not. If the form is qualified, all of the elements in the XML document use the targetNamespace. If the form is unqualified the elements belong to no namespace unless they are explicitly specified. You would do this inline by adding the attribute form=”qualified” to the element you would like to be included in the namespace. An example of this would be:
<element name="assignment" type="stringo" minOccurs="0" maxOccurs="unbounded" form="qualified">
So to conclude, there aren’t too many scenarios where you would want to set elementFormDefault=”unqualified”, just know it is out there.
“The only source of knowledge is experience”