473,799 Members | 3,146 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Create simpleType for date format

Hi,

I want to create a simpleType that will constrain an element to be a date of
the form dd/mm/yyyy.

I have this at the moment,

<xs:simpleTyp e name="newDate">
<xs:restricti on base="xs:string ">
<xs:pattern
value="((0[1-9]|1\d|2[0-9])/([0][1-9]|1[0-2])|30/(0[13-9]|1[0-2])|31/(0[13578]|1[02]))/\d\d\d\d" />
</xs:restriction>
</xs:simpleType>

but that doesn't work for leap years. Is it possible to use the date base
type. Something like:
<xs:simpleTyp e name="newDate">
<xs:restricti on base="xs:date">
??? what goes here ???
</xs:restriction>
</xs:simpleType>

Thanks!
Mar 6 '06 #1
2 1442


ZagrebMike wrote:
I want to create a simpleType that will constrain an element to be a date of
the form dd/mm/yyyy.


Consider using the predefined xs:date data type. If you need a different
format when representing dates later you can always transform from
yyyy-mm-dd to your format while using the predefined type in your XML
means any schema aware software will understand values to be of the type
date.
--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Mar 6 '06 #2
Good thought, but I should have mentioned that this is part of a schema
defining the input in a BizTalk receive pipeline. The format is required to
check that the application generates the date in the correct format.

"Martin Honnen" wrote:


ZagrebMike wrote:
I want to create a simpleType that will constrain an element to be a date of
the form dd/mm/yyyy.


Consider using the predefined xs:date data type. If you need a different
format when representing dates later you can always transform from
yyyy-mm-dd to your format while using the predefined type in your XML
means any schema aware software will understand values to be of the type
date.
--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/

Mar 6 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
6706
by: Ian Griffiths | last post by:
I have been given a schema, instances of which I'm required to be able to consume and generate. I'd like to be able to manipulate these instances as DataSets internally in my application. The schema defines the following simpleType: <xs:simpleType name="cs"> <xs:restriction base="xs:token"> <xs:pattern value="*"/> </xs:restriction> </xs:simpleType>
2
1907
by: Josh Armstrong | last post by:
I have a form with 4 text boxes; the data that is entered into them are as follows. Text1= Start Time Text2= End Time Text3= Date Text4= Interval I need the form to populate a table with sequential times based on the start/end times, interval given. Then attach the same date to each record.
1
9541
by: mahnovetsky | last post by:
Does anybody know of a way to set the format property for a date field in VBA?? I need to set the property to medium so I can display display aussie dates on a graph.. Here is what Im doing: 1) Im creating a table on the fly ' Delete the temporary temp if it exists. On Error GoTo error
2
13931
by: Alicia | last post by:
Does anyone know why I am getting a "Syntax error in Create Table statement". I am using Microsoft Access SQL View to enter it. Any other problems I may run into? CREATE TABLE weeks ( weekstart datetime not null primary key, weekend datetime not null )
5
3059
by: Apple | last post by:
May anyone can teach me how to assign a autonumber, I want to create a number that is starting with year(auto change to year 2006) + autonumber (eg. 2005-0001, 2005-0002)
2
2289
by: aevans1108 | last post by:
Greetings Please give me a push in the right direction if this the wrong place to ask this question. Why is it that I can get the count of facets for an element restriction if the corresponding simpleType is declared inline, but I can't get it if the simpleType is globally defined? Given this schema:
0
1005
by: beyonddc.storage | last post by:
Below is my current schema <xs:simpleType name="LongType"> <xs:restriction base="xs:long"> </xs:restriction> </xs:simpleType> <xs:simpleType name="MaxLong"> <xs:restriction base="LongType"> <xs:minInclusive value="1"/>
0
1800
by: DotDidIt | last post by:
Hi Everybody! I developed a Web service with IBM RAD v 6.0.1. After creating the WSDL file i have tried to develop a .Net client. But by using wsdl.exe (1.1.4322) to create a .net c# proxy i get the following error message: Schema parsing error Namespace 'http://session.ejbs.cac.commerce.com' is not available to be referenced in this schema. Schema parsing error Namespace 'http://session.ejbs.cac.commerce.com'
2
1754
by: Greg McLennan | last post by:
I am writing some Visual basic code that needs to create a M$ Access DB with a table that has a DATE ROW with dd/mm/yyyy in the Format as you would see in the general tab of the table-view. e.g sql = "CREATE TABLE DailyTbale ( DATE(dd/mm/yyyy)" That type of thing. ?? Any Takers ??
0
9688
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10490
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10260
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10030
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6809
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5467
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5590
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4146
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3762
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.