![]() |
![]() | ![]() | ![]() | Altova Mailing List Archives>Archive Index >xmlschema-dev Archive Home >Recent entries >Thread Prev - "For compatibility" in XML Schema >Thread Next - Can this schema be written in XML Schema? Re: Attributes, simpleContent, etc.To: "Jon Berndt" <jsb@------.--->, <xmlschema-dev@--.---> Date: 11/27/2005 11:15: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.
e.g.
<xs:simpleType name="positiveDouble">
<xs:restriction base="xs:double">
<xs:minExclusive value="0"/>
</xs:restriction>
</xs:simpleType>
<xs:element name="wingarea">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="positiveDouble">
<xs:attribute name="unit" use="optional" default="FT2">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="M2"/>
<xs:enumeration value="FT2"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
HTH,
Pete.
--
=============================================
Pete Cordell
for XML to C++ data binding visit
http://www.tech-know-ware.com/lmx
(or http://www.xml2cpp.com)
=============================================
----- Original Message -----
From: "Pete Cordell" <petexmldev@t...>
To: "Jon Berndt" <jsb@h...>; <xmlschema-dev@w...>
Sent: Sunday, November 27, 2005 10:05 AM
Subject: Re: Attributes, simpleContent, etc.
>
> Hi Jon,
>
> Based on a quick look, try changing the line:
>
> <xs:restriction base="xs:double">
>
> and its corresponding </xs:restriction> to:
>
> <xs:extension base="xs:double">
>
> "simpleType" explanation[:-)]: you're extending (rather than restricting)
> the double simpleType into simpleContent.
>
> HTH,
>
> Pete.
> --
> =============================================
> Pete Cordell
> for XML to C++ data binding visit
> http://www.tech-know-ware.com/lmx
> (or http://www.xml2cpp.com)
> =============================================
>
> ----- Original Message -----
> From: "Jon Berndt" <jsb@h...>
> To: <xmlschema-dev@w...>
> Sent: Friday, November 25, 2005 5:23 PM
> Subject: Attributes, simpleContent, etc.
>
>
>>
>> I am just beginning to work with schemas. I'm having a little trouble
>> authoring a schema.
>> (I'm using the oXygenXML editor, if that matters). If there is a better
>> place for me to
>> post this, please let me know.
>>
>> I have an element in my XML document that looks as follows:
>>
>> <wingarea unit="FT2"> 174.0 </wingarea>
>>
>> The element is required, the content must be greater than 0, and the unit
>> can be one of
>> FT2 or M2 (the unit is optional, with FT2 being the default). I've read
>> up
>> on this, but so
>> far I've been unsuccessful at making the correct schema, according to the
>> oXygen XML error
>> messages I get.
>>
>> Here's what I've got so far:
>>
>> <xs:element name="wingarea">
>> <xs:complexType>
>> <xs:simpleContent>
>> <xs:restriction base="xs:double">
>> <xs:minExclusive value="0"/>
>> <xs:attribute name="unit" use="optional" default="FT2">
>> <xs:simpleType>
>> <xs:restriction base="xs:string">
>> <xs:enumeration value="M2"/>
>> <xs:enumeration value="FT2"/>
>> </xs:restriction>
>> </xs:simpleType>
>> </xs:attribute>
>> </xs:restriction>
>> </xs:simpleContent>
>> </xs:complexType>
>> </xs:element>
>>
>> I get an error message when I try and validate a document using this
>> schema:
>>
>> --- start error message ---
>>
>> "Complex Type Definition Representation Error for type
>> '#AnonType_wingarea'. When
>> <simpleContent> is used, the base type must be a complexType whose
>> content
>> type is simple,
>> or, only if restriction is specified, a complex type with mixed content
>> and emptiable
>> particle, or, only if extension is specified, a simple type. 'double'
>> satisfies none of
>> these conditions. URL: http://www.w3.org/TR/xmlschema-1/#src-ct"
>>
>> --- end error message ---
>>
>> I'd be grateful if someone can give me a "simpleType" of explanation of
>> where I've gone
>> wrong! Thanks.
>>
>> Jon Berndt
>> League City, TX
From jsb@h... Sun Nov 27 13:55:59 2005
Received: from aji.w3.org ([133.27.228.225] helo=aji.w3.mag.keio.ac.jp)
by frink.w3.org with esmtp (Exim 4.50)
id 1EgN0Z-00046D-MQ
for xml | ![]() | ![]() | ![]() |
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | |||||
|
