![]() |
![]() | ![]() | ![]() | Altova Mailing List Archives>Archive Index >xmlschema-dev Archive Home >Recent entries >Thread Prev - Re: Attributes, simpleContent, etc. [Thread Next] RE: Attributes, simpleContent, etc.To: <xmlschema-dev@--.---> Date: 11/27/2005 1:54:00 AM
> 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:restriction>
</xs:simpleType>
<xs:simpleType name="PositiveNumber">
<xs:restriction base="xs:double">
<xs:minExclusive value="0"/>
</xs:restriction>
</xs:simpleType>
<!-- Wing Area -->
<xs:element name="wingarea">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="PositiveNumber">
<xs:attribute name="unit" use="optional" default="FT2"
type="AreaType"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
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.
Jon
Project Coordinator,
JSBSim Flight Dynamics Model Project
www.jsbsim.org
From mark@a... Wed Nov 30 13:14:42 2005
Received: from wiggum.w3.org ([128.3 | ![]() | ![]() | ![]() |
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | |||||
|
