473,695 Members | 1,926 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Date datatype in my schema

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.000 0000-06:00" and not as I expected, which are
supposed to be a simple date, such as "1973-10-27" as per the W3C spec.

Also, when I validate the document, it fails on all date elements with this
error:

C:\Documents and Settings\DSlinn \Desktop\GroupI mportXML\groupi mport.xml(17):
The 'http://gms.ca/groupimport.xsd :EnrollmentDate ' element has an invalid
value according to its data type. An error occurred at , (17, 54).

When I fix the date to not include the time information, it passes the
validation. Is this a bug, and if not, how can I prevent Visual Studio from
inserting the time information in my date elements?
Nov 12 '05 #1
2 1889
Raj
David,
xs:dateTime will give an output of 1999-05-31T13:20:00.000-05:00 while
xs:date will give an output of 1999-05-31.Based on your input XML format, use
the appropriate datatype.
Try generating an XML instance from the schema and see what it expects!
Hope it helps
Thanks
Raj

"David Slinn" wrote:
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.000 0000-06:00" and not as I expected, which are
supposed to be a simple date, such as "1973-10-27" as per the W3C spec.

Also, when I validate the document, it fails on all date elements with this
error:

C:\Documents and Settings\DSlinn \Desktop\GroupI mportXML\groupi mport.xml(17):
The 'http://gms.ca/groupimport.xsd :EnrollmentDate ' element has an invalid
value according to its data type. An error occurred at , (17, 54).

When I fix the date to not include the time information, it passes the
validation. Is this a bug, and if not, how can I prevent Visual Studio from
inserting the time information in my date elements?

Nov 12 '05 #2
Raj,

I set the XML schema to the Date datatype - my problem is with the datagrid
view of the XML data (based on the schema document) that visual studio uses.
When I enter data using the data grid, then switch back to the text view, it
is ignoring that my data type is Date and it creates dateTime values as I
indicated. I feel like this is a bug or something, because the document
will now no longer validate against the very schema visual studio used to
display the grid view. Maybe I'm the only one using grid view to enter data
into an XML file using an XML schema with a date data type??

- D

"Raj" <Ra*@discussion s.microsoft.com > wrote in message
news:65******** *************** ***********@mic rosoft.com...
David,
xs:dateTime will give an output of 1999-05-31T13:20:00.000-05:00 while
xs:date will give an output of 1999-05-31.Based on your input XML format, use the appropriate datatype.
Try generating an XML instance from the schema and see what it expects!
Hope it helps
Thanks
Raj

"David Slinn" wrote:
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.000 0000-06:00" and not as I expected, which are
supposed to be a simple date, such as "1973-10-27" as per the W3C spec.

Also, when I validate the document, it fails on all date elements with this error:

C:\Documents and Settings\DSlinn \Desktop\GroupI mportXML\groupi mport.xml(17): The 'http://gms.ca/groupimport.xsd :EnrollmentDate ' element has an invalid value according to its data type. An error occurred at , (17, 54).

When I fix the date to not include the time information, it passes the
validation. Is this a bug, and if not, how can I prevent Visual Studio from inserting the time information in my date elements?

Nov 12 '05 #3

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

Similar topics

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>
0
2200
by: Bernhard Kraft | last post by:
If I specify a default value in an .xsd-File like this ... <xs:element name="element1" type="xs:dateTime" minOccurs="0" default="2004-02-10T00:00:00.0000000+01:00" /> .... and try to build a dataset with xsd /d Dataset.xsd, i receive an "value doesn't fit the datatype" error. I tried already formats like "2001-01-01" or "2000/01/01" with the same result.
0
1478
by: Andrew Burgher | last post by:
Feeding the following .xsd into the XsdObjectGen (v1.4.2.0) tool produces an invalid attribute: with DataType="System.String". Has anybody seen this behaviour before? Is this a bug in XsdObjectGen? or a problem with the input schema? I'm trying to avoid hacking the generated code... In: <?xml version = "1.0" encoding = "UTF-8"?> <xsd:schema elementFormDefault="qualified" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
3
5993
by: RJA | last post by:
Hiyas, Using VS .net 2003. Setting up a Webservice that accepts 3rd party vendor designed XML requests and returns a filled XMLDocument with response data. Vendor XSDs were serialize into class objects to be used in the program. EX: Used xsd.exe to turn VendorA_Request.XSD into VendorA_Request.cs EX: Used xsd.exe to turn VendorA_Response.XSD into VendorA_Response.cs
0
1441
by: Priya | last post by:
hi all, I need to read the xml schema file and retrieve the sql:datatype element value in the xsd file. The schema file format is below <xsd:sequence> <xsd:element name="safe_job" type = "xsd:string" sql:datatype="varchar(255)" /> </xsd:sequence>
4
11961
by: Orchid | last post by:
How can I change a Date datatype to a Number datatype? For example, I want a date 10/31/2006 to show 1031 as Number datatype. But I don't want it becomes 39021. What formula should I use? Thanks for your help!!
10
4779
by: Henrik Dahl | last post by:
Hello! I have an xml schema which has a date typed attribute. I have used xsd.exe to create a class library for XmlSerializer. The result of XmlSerializer.Serialize(...) should be passed as the value for the parameter of an SqlCommand for inserting the xml document in a column of a table where the column is typed to be of the same xml schema. This all sounds simple, but SQL Server REQUIRES the timezone to be specified for date values....
10
17000
by: DontellTrevell via AccessMonster.com | last post by:
HELP!!....I need to calculate the numer of days elapsed between two field. But, the date format is YYYYMMDD. How can i accomplsh this? -- Dontell Trevell Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/Forums.aspx/databases-ms-access/200701/1
2
3842
by: Andy B | last post by:
How do you write date and times into an attribute with a datetime databype? I tried: <NewsArticle Date="2008-05-11 11:20:00 AM"> But the schema generated from the xml file says the Date attribute is a string. Then I tried: <NewsArticle Date = 2008-05-11 11:20:00 Pm> Again, this didn't work because the conversion program complained and told
0
8565
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
8822
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
7658
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
6488
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
5838
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
4577
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2997
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
2269
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
1971
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.