What they do and what they need targetNamespace and elementFormDefault c attributeFormDefault?
<?xml version="1.0" encoding="UTF-8"?> <schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.example.com/students" xmlns:tns="http://www.example.com/students" elementFormDefault="qualified"> <element name="students"> ...
Let me explain.
targetNamespace - Gives a target area of names for the scheme.
elementFormDefault - Does it matter whether the elements xml of the document for which xsd-schem is defined shall belong to the area of the name specified in the attribute targetNamespace♪ Accepts two values:
- qualified - all elements should be owned by the target area
- unqualified - all elements of the scheme do not belong to the target space
Name(s) of default. For each element, there is a need for a clear indication of the identity of the area, if necessary.
Let's see your example of xsd of the scheme. students Type type=string)
You indicated for the attribution. elementFormDefault value qualifiedthat means that the element students shall belong to the area of the name indicated in the attribute targetNamespace♪
The next xml document will be validated for this definition.
<?xml version="1.0" encoding="UTF-8" ?> <ex:students xmlns:ex="http://www.example.com/students">sdsd</ex:students>
Element students is in the area of the name indicated in the description xsd-schems in the attribute targetNamespace♪
If we try to identify the element studentswithout placing him in the target area of names
<?xml version="1.0" encoding="UTF-8" ?> <students>sdsd</students>
We'll make a mistake that the element students Not found.
attributeFormDefault - his role is the same as attribute. elementFormDefaultbut not for the schematic elements, but for the attributes (the attributes should belong to the target area of names). Accepts the same values.
I hope I've been able to explain to you what it takes.