IMPORTANT:
this is not a Support Forum! Experienced users might answer from time to time questions posted here. If you need a professional and reliable answer, or if you want to report a bug, please contact Altova Support instead.

Schema for element that may be a float or a string Options · View
rowan.bradley
Posted: Thursday, June 25, 2015 4:41:21 PM
Rank: Newbie

Joined: 6/25/2015
Posts: 2
Location: Newmarket, Suffolk, UK
Can someone tell me how to construct an XSD schema for an element that can be a positive float or the word "Auto"?

Thanks - Rowan
vlad
Posted: Thursday, June 25, 2015 6:07:24 PM
Rank: Advanced Member

Joined: 12/13/2005
Posts: 2,856
Location: Mauritius
This should do the thing:

Code:
                            <xs:simpleType>
                                <xs:union>
                                    <xs:simpleType>
                                        <xs:restriction base="xs:float">
                                            <xs:minExclusive value="0"/>
                                        </xs:restriction>
                                    </xs:simpleType>
                                    <xs:simpleType>
                                        <xs:restriction base="xs:string">
                                            <xs:enumeration value="Auto"/>
                                        </xs:restriction>
                                    </xs:simpleType>
                                </xs:union>
                            </xs:simpleType>
rowan.bradley
Posted: Monday, June 29, 2015 11:11:54 AM
Rank: Newbie

Joined: 6/25/2015
Posts: 2
Location: Newmarket, Suffolk, UK
Brilliant. This has worked fine. I had tried to use Union in one of my previous attempts, but must have got it wrong somehow.

Thanks - Rowan
Users browsing this topic
guest

Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Use of the Altova User Forum(s) is governed by the Altova Terms of Use.