Previous Topic Next topic Print topic


XML Schemas

An XML schema (usually an .xsd file) is made up in part of element definitions. These definitions dictate the structure and content of an XML instance document that references the schema. XML elements can have attributes associated with them. These attributes further describe the data contained in the element.

The following is an example of a simple XML schema:

Sample XML Schema

<?xml version="1.0" encoding="utf-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema" 
   elementFormDefault="qualified">
   <element name="employee">
      <complexType>
         <sequence>
            <element name="emp-name">
               <simpleType>
                  <restriction base="string">
                     <length value="12"/>
                  </restriction>
               </simpleType>
            </element>
            <element name="emp-number">
               <simpleType>
                  <restriction base="string">
                     <length value="8"/>
                  </restriction>
               </simpleType>
            </element>
         </sequence>
      </complexType>
   </element>
</schema>

This schema defines a parent element, employee, with two child elements, emp-name and emp-number. Each of the child elements contains two child elements of its own - restriction and length. In this implementation of XML support, the base and value attributes for those elements are translated into COBOL record PIC clauses.

Previous Topic Next topic Print topic