• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 15. Repurposing XML Content > The Structure of the XML Schema

The Structure of the XML Schema

One of the requirements is to combine the assorted department information into one view. The view also is based on XML. A schema has been created that describes how the combined XML file is to be structured. Listing 15.2 shows the scorecard.xsd file.

Listing 15.2. The schema that describes the combined department data

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <xsd:element name="Composite">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element ref="Scorecard"
               minOccurs="1" maxOccurs="1"/>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>
  <xsd:element name="Scorecard">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element name="Month" type="xsd:string"
               minOccurs="0"/>
        <xsd:element name="Year" type="xsd:integer"
               minOccurs="0"/>
        <xsd:element name="Comment" type="xsd:string"
               minOccurs="0"/>
        <xsd:element name="Budget">
          <xsd:complexType>
            <xsd:sequence>
              <xsd:element name="Department" minOccurs="0">
                <xsd:complexType mixed="true">
                  <xsd:sequence>
                    <xsd:element name="Variance"
                           type="xsd:decimal" minOccurs="0">
                    </xsd:element>
                 </xsd:sequence>
                </xsd:complexType>
              </xsd:element>
            </xsd:sequence>
          </xsd:complexType>
        </xsd:element>
        <xsd:element name="Training">
          <xsd:complexType>
            <xsd:sequence>
              <xsd:element name="Department" minOccurs="0">
                <xsd:complexType mixed="true">
                  <xsd:sequence>
                    <xsd:element name="Variance"
                           type="xsd:decimal" minOccurs="0">
                    </xsd:element>
                  </xsd:sequence>
                </xsd:complexType>
              </xsd:element>
            </xsd:sequence>
          </xsd:complexType>
        </xsd:element>
        <xsd:element name="Absence">
          <xsd:complexType>
            <xsd:sequence>
              <xsd:element name="Department" minOccurs="0">
                <xsd:complexType mixed="true">
                  <xsd:sequence>
                    <xsd:element name="Variance"
                           type="xsd:decimal" minOccurs="0">
                    </xsd:element>
                  </xsd:sequence>
                </xsd:complexType>
              </xsd:element>
            </xsd:sequence>
          </xsd:complexType>
        </xsd:element>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>
</xsd:schema>


					  


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint