473,909 Members | 4,735 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 1913
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
2209
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
1486
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
6005
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
1453
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
11977
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
4800
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
17047
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
3847
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
10035
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...
1
11046
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
10538
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
9725
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
8097
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
5938
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
6138
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4336
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3357
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.