472,992 Members | 3,592 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

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.0000000-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\GroupImportXML\groupimport .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 1844
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.0000000-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\GroupImportXML\groupimport .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*@discussions.microsoft.com> wrote in message
news:65**********************************@microsof t.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.0000000-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\GroupImportXML\groupimport .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
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...
0
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...
0
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...
3
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...
0
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 =...
4
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? ...
10
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...
10
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...
2
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...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...
3
SueHopson
by: SueHopson | last post by:
Hi All, I'm trying to create a single code (run off a button that calls the Private Sub) for our parts list report that will allow the user to filter by either/both PartVendor and PartType. On...

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.