Making Validation More Specific

<<< As it stands, the specification for a valid <station> isn't as precise as we'd like. A latitude must be between -90 and 90, and a longitude between -180 and 180. Weather station abbreviations are exactly four letters long, and the weather station's full name should be restricted to at most seventy-five characters. The bold text shows what needs to be added to the RELAX specification:

    <tag name="station">
        <attribute name="fullname" type="string" required="true">
            <maxlength value="75"/>
        <attribute name="abbrev" type="string" required="true">
            <length value="4"/>

    <elementRule role="latitude" type="decimal">
        <minInclusive value="-90"/>
        <maxInclusive value="90"/>
    <tag name="latitude"/>

    <elementRule role="longitude" type="decimal">
        <minInclusive value="-180"/>
        <maxInclusive value="180"/>
    <tag name="longitude"/>

Next, the document specifies the <temperature> element. >>>

  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