Tutorial 3 validating an xml document
The declaration method is different depending on whether the element element has a child element or not.
When no child element is present, the element name is designated with the name attribute, and the data type is designated using the type attribute.
Traditionally, DTD has been the standard for XML schema definition; however, XML usage has expanded dramatically in core application systems, being tailored for a wide range of purposes for which DTD is not fully capable of supporting.
xmlns:xsi=" xsi:no Namespace Schema Location="employee.xs" From here, using the LIST2 file as an example, we will explain the method for writing XML schema.
Table : Main XML Schema Data Types ●General Data Types This "Employee Type type" designated by the type attribute is a Complex Data Type. In the actual content of the Complex Type, Employee Type type is designated with the name attribute of the complex Type element, and the Model Group (settings method for the occurrence order of the child element) is designated in the child element.
In the Model Group, use the sequence element to output occurrences in the order written (equivalent to the "," in DTD), and use the choice element to output the occurrence of any given element (equivalent to the "|" in DTD).
LIST3 is an example of a valid XML document for the LIST2 XML Schema (employee.xml).
LIST3: Valid XML Document for XML Schema (employee.xml) For DTD, a DOCTYPE declaration is used to associate with the XML document; but, in the case of XML Schema, the specification does not particularly determine anything with respect to the association of the XML document.
For Model Group element declarations, the most common method is to designate the ref attribute of the element element, referencing the element declared in a separate location (LIST4).