Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » XML Schema Definition (XSD) » how to validate dataTime with xsd
how to validate dataTime with xsd [message #1461113] Tue, 04 November 2014 08:09 Go to next message
giovanna zoppi is currently offline giovanna zoppiFriend
Messages: 1
Registered: November 2014
Junior Member
good morning,
i have a problem to validate my date or dataTime data with xsd.
the only accepetd value is like yyyy-mm-dd for example 2014-11-04 or for dataTime is 2014-11-03T09:00:00.
but how may i manage other data format?
for example if i would accept value: 04/11/2014 how have to set my xsd?

now my element data is an union of date and dataTime but in this way accept only standard format
my xsd:
<xs:simpleType name="newdata">
<xs:union memberTypes="xs:date">
<xs:simpleType>
<xs:restriction base="xs:dateTime">
</xs:restriction>
</xs:simpleType>
</xs:union>
</xs:simpleType>
<xs:element name="DATA" minOccurs="0" maxOccurs="1" type="newdata" />

thanks a lot
Re: how to validate dataTime with xsd [message #1461348 is a reply to message #1461113] Tue, 04 November 2014 13:09 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
You'd need to define your own simple type; one that has no relation to
any of the built-in date/time types. (It's probably not a good idea.)

On 04/11/2014 1:12 PM, giovanna zoppi wrote:
> good morning,
> i have a problem to validate my date or dataTime data with xsd.
> the only accepetd value is like yyyy-mm-dd for example 2014-11-04 or
> for dataTime is 2014-11-03T09:00:00.
> but how may i manage other data format?
> for example if i would accept value: 04/11/2014 how have to set my xsd?
>
> now my element data is an union of date and dataTime but in this way
> accept only standard format
> my xsd:
> <xs:simpleType name="newdata">
> <xs:union memberTypes="xs:date">
> <xs:simpleType>
> <xs:restriction base="xs:dateTime">
> </xs:restriction>
> </xs:simpleType>
> </xs:union>
> </xs:simpleType>
> <xs:element name="DATA" minOccurs="0" maxOccurs="1" type="newdata" />
>
> thanks a lot


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:A diagram of XMI
Next Topic:Help needed Creating XSD for source XML
Goto Forum:
  


Current Time: Thu Mar 28 19:10:32 GMT 2024

Powered by FUDForum. Page generated in 0.02508 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top