473,406 Members | 2,707 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Help in dateTime Schema pattern

3
I declared one element in my XML Schema by restriction base= "xs:dateTime", with the Pattern value as dd/mm/yyyy, when I validate the
XML with this format, it shows the error that the
give value is not valid, so my question is how to change the date format in
XML Schema ??

Thanks
Nerd
Nov 5 '07 #1
2 6363
jkmyoung
2,057 Expert 2GB
I declared one element in my XML Schema by restriction base= "xs:dateTime", with the Pattern value as dd/mm/yyyy, when I validate the
XML with this format, it shows the error that the
give value is not valid, so my question is how to change the date format in
XML Schema ??

Thanks
Nerd
xs:datetime is a specific format, being: 0001-01-01T00:00:00 which corresponds to YYYY-MM-DDThh:mm:ss

I'd use a pattern restriction like so:
Expand|Select|Wrap|Line Numbers
  1. <xs:simpleType>
  2.     <xs:restriction base="xs:string">
  3.         <xs:pattern value="([0-9]{2}/){2}[0-9]{4}"/>
  4.     </xs:restriction>
  5. </xs:simpleType>
Note, this pattern does not validate number of days in a month etc. If you want that, you need a more complex pattern. eg see http://www.thescripts.com/forum/thread728713.html
Nov 6 '07 #2
Nerds
3
Thanks for the help i will try like this..

thanks
nerds
xs:datetime is a specific format, being: 0001-01-01T00:00:00 which corresponds to YYYY-MM-DDThh:mm:ss

I'd use a pattern restriction like so:
Expand|Select|Wrap|Line Numbers
  1. <xs:simpleType>
  2.     <xs:restriction base="xs:string">
  3.         <xs:pattern value="([0-9]{2}/){2}[0-9]{4}"/>
  4.     </xs:restriction>
  5. </xs:simpleType>
Note, this pattern does not validate number of days in a month etc. If you want that, you need a more complex pattern. eg see http://www.thescripts.com/forum/thread728713.html
Nov 6 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Henry | last post by:
I have a table that stores a list of zip codes using a varchar column type, and I need to perform some string prefix pattern matching search. Let's say that I have the columns: 94000-1235 94001...
1
by: Jeff | last post by:
For the life of me, I can't create a working regular expression for a schema pattern to do the following: Validates if an entire word does NOT match the entire word in the pattern. For...
2
by: M Rao | last post by:
I have xml data coming in as a stream from a web service running against exchange server.The attributes for the elements dtstart and dtend, b:dt="dateTime.tz"...
1
by: Jeff S | last post by:
Hello all, I'm trying to design a schema from which I can generate a typed dataset class. I'm having problems incorporating choice and enumerations in the schema and getting the xml results...
2
by: Tarren | last post by:
Hi: The problem I am having is when I validate an xml file to a schema, it is erroring out every element. I think this has something to do with me defining/referencing the namespaces. I have...
0
by: Vish | last post by:
I am trying to use xmldatadocument to load an xml file.The xml has the data as attributes, the datadocument is able to successfully parse the document into the tables and shows the right column...
3
by: Flomo Togba Kwele | last post by:
I'm looking to replace all commas in a single string not contained within a pair of double-quotes, with a tab. I don't know where to begin. e.g., string line = "a,",,"b" would be changed to...
3
by: =?Utf-8?B?TmF2ZWVu?= | last post by:
Not sure if this is the right forum for this question but couldn'd find another newsgroup. I am new to Regular expressions and would like help in deciding which pattern allows me to split a...
1
by: dburdett | last post by:
I am kind of new with building a schema and being able to validate a XML file against the schema stored on our web site. I have schema that I have built that resides at: ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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,...
0
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...
0
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,...

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.