This week's book giveaway is in the Big Data forum.
We're giving away four copies of Elasticsearch in Action and have Radu Gheorghe & Matthew Lee Hinman on-line!
See this thread for details.
The moose likes XML and Related Technologies and the fly likes XSD - restrctions/enumeration - Only Weekdays Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Elasticsearch in Action this week in the Big Data forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "XSD - restrctions/enumeration - Only Weekdays" Watch "XSD - restrctions/enumeration - Only Weekdays" New topic
Author

XSD - restrctions/enumeration - Only Weekdays

kri shan
Ranch Hand

Joined: Apr 08, 2004
Posts: 1383
How to restrict the week days(MON thru FRI) only using xsd:restriction and xsd:enumeration ? xs:pattterns needed?
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10394
    
174

Look at this w3schools example.


[My Blog] [JavaRanch Journal]
kri shan
Ranch Hand

Joined: Apr 08, 2004
Posts: 1383
Hi Jaikiran, I already googled this link.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 19351
    
  10

And did it answer your question?
kri shan
Ranch Hand

Joined: Apr 08, 2004
Posts: 1383
<xs:element name="Weekdays">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Monday"/>
<xs:enumeration value="Tuesday"/>
<xs:enumeration value="Wednesday"/>
<xs:enumeration value="Thursday"/>
<xs:enumeration value="Friday"/>
</xs:restriction>
</xs:simpleType>
</xs:element>

Is it correct?
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 19351
    
  10

kri shan wrote:Is it correct?

You mean, does it match your requirements? Only you can say. Let us know when you try it out on your data.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: XSD - restrctions/enumeration - Only Weekdays