-
Why do I get error when I try to insert a XML docment with date element into SQL 2005
Why do I get error when I try to insert a XML docment with date element into SQL 2005 database?
When I the following XML with date element into database, I get the error information below, why?
.Net SqlClient Data Provider: Msg 6926, Level 16, State 1, Line 2
XML Validation: Invalid simple type value: '2005-12-23'. Location: /*:Folder[1]/*:Bookmark[1]/*:InputDate[1]
//---------------------------------XSD for Bookmark field------------------------------------------
CREATE XML SCHEMA COLLECTION [dbo].[mycollect]
AS N'
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="Folder" type="folderType"/>
<xsd:complexType name="bookmarkType">
<xsd:sequence>
<xsd:element name="Title" type="xsd:string" />
<xsd:element name="Url" type="xsd:string" />
<xsd:element name="Description" type="xsd:string" />
<xsd:element name="InputDate" type="xsd:date" />
<xsd:element name="IsPrivate" type="xsd:boolean" />
</xsd:sequence>
<xsd:attribute name="BId" type="xsd:string" />
</xsd:complexType>
<xsd:complexType name="folderType">
<xsd:all>
<xsd:element name="Folder" type="folderType" minOccurs="0" />
<xsd:element name="Bookmark" type="bookmarkType" minOccurs="0" />
</xsd:all>
<xsd:attribute name="Name" type="xsd:string" />
<xsd:attribute name="Id" type="xsd:string" />
</xsd:complexType>
</xsd:schema>
'
GO
//---------------------------------XSD for Bookmark field----------------------------------------------
//---------------------------------Insert XML with date element into database----------------------------
INSERT INTO cw_Bookmark (UserID,Bookmark) VALUES ('b50cf8fe-749c-4e38-ab2f-6d0ui9711brt',
'
<Folder Name="Root" Id="a6dce8fe-749c-4e38-ab2f-3d03d9711b3d">
<Bookmark BId="f8dce8hj-846c-4e38-ab2f-6d03d9711b80">
<Title>CodeGuru Forums - ASP.NET</Title>
<Url>http://www.codeguru.com/</Url>
<Description>This is a good site</Description>
<InputDate>2005-12-23</InputDate>
<IsPrivate>false</IsPrivate>
</Bookmark>
<Folder Name="Card1" Id="b8dcf8fe-749c-4e38-ab2f-6d03d9711b8j">
<Bookmark BId="fkdfh3a8-456c-6y38-jk2f-5h0gh9711b45">
<Title>Keystone DreamCard</Title>
<Url>https://www.mydreamcardonline.com</Url>
<Description>Please note</Description>
<InputDate>2004-09-25</InputDate>
<IsPrivate>true</IsPrivate>
</Bookmark>
<Folder Name="Card1in1" Id="l9dcf8fe-689c-0935-fghj-7u03d9711b5t">
<Bookmark BId="ghdfh3a8-896c-6y40-jkfg-5h0gh9711b89">
<Title>The News of CNN</Title>
<Url>https://www.cnn.com</Url>
<Description>Please note</Description>
<InputDate>2004-09-23</InputDate>
<IsPrivate>True</IsPrivate>
</Bookmark>
</Folder>
</Folder>
</Folder>
')
//---------------------------------Insert XML with date element into database----------------------------
Similar Threads
-
Replies: 0
Last Post: 07-18-2005, 10:43 AM
-
Replies: 5
Last Post: 01-10-2003, 08:39 PM
-
By Allen Pitts in forum XML
Replies: 0
Last Post: 10-31-2002, 03:02 PM
-
By Paul Maher in forum XML
Replies: 1
Last Post: 12-16-2000, 02:28 AM
-
By HSIN NING in forum Web
Replies: 0
Last Post: 08-21-2000, 12:21 AM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks