Further Specifications

<<< Here's the <temperature> part of the weather report:


A <temperature> has four sub-elements. We want them all to be within a reasonable range of Celsius temperatures. The current version of RELAX doesn't let you make a single definition and reuse it four times. Thus, you have to type all the specifications for the sub-elements individually. Note that it is also possible to put the <tag> element inside the <elementRule>

    <elementRule role="min" type="integer">
        <tag name="min"/>
        <minInclusive value="-70"/>
        <maxInclusive value="70"/>

    <elementRule role="max" type="integer">
        <tag name="max"/>
        <minInclusive value="-70"/>
        <maxInclusive value="70"/>

    <elementRule role="forecast-low" type="integer">
        <tag name="forecast-low"/>
        <minInclusive value="-70"/>
        <maxInclusive value="70"/>

    <elementRule role="forecast-high" type="integer">
        <tag name="forecast-high"/>
        <minInclusive value="-70"/>
        <maxInclusive value="70"/>

Once these are defined, the specification of the <temperature> element is straightforward:

    <elementRule role="temperature">
            <ref label="min"/>
            <ref label="max"/>
            <ref label="forecast-low"/>
            <ref label="forecast-high"/>
    <tag name="temperature"/>

Now, it remains only to define the <wind> portion of the weather report. >>>

  1. Validating XML with RELAX
  2. Validity and the DTD
  3. Validity and RELAX
  4. Specifying Elements
  5. Making Validation More Specific
  6. Further Specifications
  7. Enumerations
  8. The Big Picture
  9. Summary