W3C home > Mailing lists > Public > xmlschema-dev@w3.org > November 2005

RE: Attributes, simpleContent, etc.

From: Jon Berndt <jsb@hal-pc.org>
Date: Sun, 27 Nov 2005 07:53:37 -0600
To: <xmlschema-dev@w3.org>

> Oops, I think I missed a bit.  I think you have to do this in two stages:
> 1. Create the positive double by restricting double.
> 2. Extending the new positive double simpleType into a simpleContent.

Thanks, Pete:

After thinking about this I decided that it would also be good to have an AreaType and a
LengthType, etc., which will be helpful shorthand in the remainder of the schema. So, with
your suggestions above, this becomes:

<!-- Global Types for this file -->

<xs:simpleType name="AreaType">
  <xs:restriction base="xs:string">
    <xs:enumeration value="M2"/>
    <xs:enumeration value="FT2"/>

<xs:simpleType name="PositiveNumber">
  <xs:restriction base="xs:double">
    <xs:minExclusive value="0"/>

<!-- Wing Area -->

<xs:element name="wingarea">
      <xs:extension base="PositiveNumber">
        <xs:attribute name="unit" use="optional" default="FT2"

The above definition worked well, and the documentation was produced correctly in
oXygenXML, which also validated the following XML:

<wingarea unit="FT2"> 174.0 </wingarea>

Thanks for your help. This is fun stuff, but sometimes frustrating.

Project Coordinator,
JSBSim Flight Dynamics Model Project
Received on Sunday, 27 November 2005 13:55:59 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:56:09 UTC