Datatype: angleType

Description:

A datatype of angleType will have (up to) three subelements, representing the degrees, minutes, and seconds, and an attribute representing the hemisphere.

Proposed Usage:

This datatype was developed to support the Epicentre angle data types. Its intended usage is shown in the PEF angle element document. However, it is clearly useful as a datatype in its own right. Its usage is shown below in the sample usage schema and sample XML.

Note that an angle can be formatted as above, with the degree, minute, second (dms) concept, or as a quantity value. This data type is intended to support the dms concept, and explicitly parses the dms into its parts. A general angle to support other formats can be a choice of the dms, the quantity, or a text field.

XML Schema:

  • The schema and examples do not explicitly show the lines that set the namespaces.
  • All schema examples will use xsd: as the namespace for the schema tags and datatypes, and null for all the locally generated namespaces.
  • XML Examples will exclude namespace modifiers for clarity. Actual XML will probably need namespaces.
  • <xsd:simpleType name="degval">
      <xsd:restriction base="xsd:nonNegativeInteger">
        <xsd:maxInclusive value="180"/>
      </xsd:restriction>
    </xsd:simpleType>
    
    <xsd:complexType name="angleType">
     <xsd:sequence>
      <xsd:element name="degree">
       <xsd:complexType>
        <xsd:simpleContent>
         <xsd:extension base="degval">
          <xsd:attribute name="direction">
           <xsd:simpleType>
           <xsd:restriction base="xsd:string">
             <xsd:enumeration value="N"/>
             <xsd:enumeration value="E"/>
             <xsd:enumeration value="S"/>
             <xsd:enumeration value="W"/>
             <xsd:enumeration value="+"/>
             <xsd:enumeration value="-"/>
           </xsd:restriction>
           </xsd:simpleType>
          </xsd:attribute>
         </xsd:extension>
        </xsd:simpleContent>
       </xsd:complexType>
      </xsd:element>
      <xsd:element name="minute" minOccurs="0">
       <xsd:simpleType>
        <xsd:restriction base="xsd:nonNegativeInteger">
         <xsd:maxExclusive value="60"/>
        </xsd:restriction>
       </xsd:simpleType>
      </xsd:element>
      <xsd:element name="second" minOccurs="0">
       <xsd:simpleType>
        <xsd:restriction base="xsd:decimal">
         <xsd:minInclusive value="0.0"/>
         <xsd:maxInclusive value="60.0"/>
        </xsd:restriction>
       </xsd:simpleType>
      </xsd:element>
     </xsd:sequence>
    </xsd:complexType>
    

    Sample Usage Schema:

  • All elements are local. It is recommended that elementFormDefault be "qualified."
  • This may be used as a choice with other angle datatypes to allow other formats. Note that W3C XML Schema has not defined any angle types.
  • It may be desirable to add an additional layer to identify the angle as a parsed angle (dms) so that a reader application will know. Both methods are shown below.
  •    <xsd:element name="latitude" type="angleType"/>
    
       <xsd:element name="longitude">
        <xsd:complexType>
         <xsd:sequence>
          <xsd:element name="dms" type="angleType"/>
         </xsd:sequence>
        </xsd:complexType>
       </xsd:element>
    

    Sample XML:

       <latitude>
         <degree direction="N">42</degree>
         <minute>22</minute>
         <second>49.23</second>
       </latitude>
     
       <longitude>
        <dms>
         <degree direction="+">9</degree>
         <minute>14</minute>
         <second>12.84</second>
        </dms>
       </longitude>
    

    Last Modified: March 21, 2001
    ©Copyright 2001 POSC. All rights reserved.