473,809 Members | 2,931 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

limit a date with XML Schema

Hi, I want to limit a date to a minDate and a maxDate -
is that possible, and how?

<xs:simpleTyp e>
<xs:restricti on base="xs:date">
<xs:
</xs:restriction>
</xs:simpleType>

I assume it is only possible with "pattern".
Cheers,

Stefan
Jan 6 '06 #1
1 1503


Stefan Reiter wrote:
Hi, I want to limit a date to a minDate and a maxDate - I assume it is only possible with "pattern".


Using minInclusive and maxInclusive for example works for me with MSXML
4 and with Xerces-Java, example schema is

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
version="1.0">

<xs:element name="root">
<xs:complexType >
<xs:sequence>
<xs:element name="date" maxOccurs="unbo unded">
<xs:simpleTyp e>
<xs:restricti on base="xs:date">
<xs:minInclusiv e value="2005-01-01" />
<xs:maxInclusiv e value="2006-01-01" />
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>

</xs:schema>

Example XML document is

<root>

<date>2005-03-01</date>
<date>2005-01-01</date>
<date>2006-01-01</date>

<date>2007-01-01</date>

</root>

The last date element is flagged by both validators as being invalid.

I am not sure however why <http://www.w3.org/TR/xmlschema-2/#date> does
not list any possible constraining facets for that date data type.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jan 6 '06 #2

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

Similar topics

5
2114
by: Jeremy | last post by:
I am relatively inexperienced with SQL, and I am trying to learn how to analyze some data with it. I have a table with the following information. COMPANY ID , DATE, MarektValue I would like to select the largest 100 marketvalues for each date in my table. How can I do this efficiently in MySql.
4
350
by: Robert Scarborough | last post by:
I have a Table in a Typed Dataset which contains a Date field called EventDate. I've ensured that the field is defined as Date as opposed to DateTime in the Typed Dataset. When I generate an xml file from an instance of this typed dataset using the ds.WriteXml method, all the dates come out formatted as follows: <EventDate>2004-01-26T00:00:00.0000000-05:00</EventDate>
2
1904
by: David Slinn | last post by:
I have created a simple XML document, generated a schema from it (which Visual Studio makes everything a string element). I then went through and changed all fields that are dates to the Date data type. Now, when I use the datagrid to edit the data in the XML file and then switch back to the raw XML text date, the dates are formatted like this "1973-10-27T00:00:00.0000000-06:00" and not as I expected, which are supposed to be a simple...
1
1260
by: Stefan Reiter | last post by:
Hi, I want to limit a date to a minDate and a maxDate - is that possible, and how? <xs:simpleType> <xs:restriction base="xs:date"> <xs: </xs:restriction> </xs:simpleType> I assume it is only possible with "pattern".
0
9600
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10633
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
10376
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...
1
10375
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9198
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7651
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6880
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();...
1
4331
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
3860
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.