XML

Important Elements in XHTMLschema.xsd

In Figure 7-1, you can also see that the essential components of a schema are element, complexType, and simpleType elements. Essentially, a schema is all about associating data types with element elements. A portion of the source code from XHTMLschema.xsd is shown below.

  <schema targetNamespace = "XHTMLschema.xsd"
      xmlns = "http://www.w3.org/xmlschema">
      <element name = "html">
          <complexType content = "elementOnly">
              <annotation>
  <documentation>
  a Uniform Resource Identifier, see [RFC2396]
  </documentation>
              </annotation>
          <group>
              <sequence>
                  <element ref = "head"/>
                  <element ref = "body"/>
              </sequence>
          </group>
          <attributeGroup ref = "i18n"/>
          </complexType>
      </element>
      <element name = "head">
          <complexType content = "elementOnly">
          <group>
              <sequence>
                  <element ref = "title"/>
                  <element ref = "base" minOccurs = "0"
                      maxOccurs = "1"/>
              </sequence>
          </group>
          <attributeGroup ref = "i18n"/>
          <attribute name = "profile" type = "string"/>
          </complexType>
      </element>
      <element name = "title">
          <complexType content = "textOnly">
              <attributeGroup ref = "i18n"/>
          </complexType>
      </element>
      <element name = "base">
          <complexType content = "empty">
              <attribute name = "target" use = "required"
                  type = "string"/>
          </complexType>
      </element>
      <element name = "atop">
          <complexType content = "elementOnly">
              <sequence>
                  <element ref = "p"/>
                  <element ref = "a"/>
              </sequence>
          </complexType>
      </element>
      <element name = "body">
          <complexType content = "elementOnly">
              <group>
                  <sequence>
                      <element ref = "basefont" minOccurs = "0"
                          maxOccurs = "1"/>
                      <element ref = "table"/>
                  </sequence>
              </group>
             <attribute name = "alink" type = "string"/>
             <attribute name = "text" type = "string"/>
             <attribute name = "bgcolor" type = "string"/>
             <attribute name = "link" type = "string"/>
             <attribute name = "vlink" type = "string"/>
          </complexType>
      </element>
      
      <element name = "h1">
          <complexType content = "elementOnly">
              <sequence>
                  <group ref = "Inline" />
              </sequence>
              <attributeGroup ref = "attrs"/>
              <attribute name = "align" type = "string"/>
          </complexType>
      </element>
      
  </schema>

This particular version of the schema does not use anything like the entities in a DTD-everything is listed out here. Schemas do provide components that are similar to parameter entities, which will be discussed later in this chapter. Comments located within the schema element are contained within documentation elements. The schema element is the root for the document. The schema element and other elements and attributes will be discussed in detail in the next section.

by BrainBellupdated
Advertisement: