364,085 Members | 5289 Browsing Online
Community for Developers & IT Professionals
Bytes IT Community

Please help, date problem with XSD file

Rajender
P: n/a
Rajender
I am getting the error:
Invalid character value for cast specification
In my xml file the date is like this:
2004-09-28T00:00:00.0000000-04:00

Because of the field eventdate which is dt:datetime in my
xsd file.

******* MY XSD file
<?xml version="1.0" ?>
<Schema xmlns="urn:schemas-microsoft-com:xml-data"
xmlns:dt="urn:schemas-microsoft-com:xml:datatypes"
xmlns:sql="urn:schemas-microsoft-com:xml-sql" >

<ElementType name="eventdate" dt:type="DateTime"/>
<ElementType name="ReferenceNO" dt:type="varchar(50)" />
<ElementType name="EventDesciption" dt:type="ntext(16)" />
<ElementType name="ModuleName" dt:type="char(20)" />
<ElementType name="ModuleID" dt:type="char(20)" />
<ElementType name="created_by" dt:type="char(20)" />

<ElementType name="ROOT" sql:is-constant="1">
<element type="Table" />
</ElementType>

<ElementType name="Table" sql:relation="Tab_ccsnetevents">
<element type="eventdate" sql:field="eventdate" />
<element type="ReferenceNO" sql:field="ReferenceNO" />
<element type="EventDesciption"
sql:field="EventDesciption" />
<element type="ModuleName" sql:field="ModuleName" />
<element type="ModuleID" sql:field="ModuleID" />
<element type="created_by" sql:field="created_by" />
</ElementType>
</Schema>
*****

Thank you very much.

Nov 12 '05 #1
Share this Question
Share on Google+
1 Reply


Derek Harmon
P: n/a
Derek Harmon
"Rajender" <reddymade@hotmail.com> wrote in message news:3be601c4ab27$a46c1f00$a301280a@phx.gbl...[color=blue]
> Because of the field eventdate which is dt:datetime in my
> xsd file.
>
> ******* MY XSD file
> <?xml version="1.0" ?>
> <Schema xmlns="urn:schemas-microsoft-com:xml-data"[/color]
: :

This is not an XSD file -- it is an XDR mapping schema.

If you're using this as the mapping schema for an SQL
Server 2000 Updategram, then you're probably missing
one of the type attributes on the eventdate element that
tells SQL Server 2000 you have an XML Schema ISO
8601 datetime,

<ElementType
name="eventdate"
xs:type="xs:dateTime"
sql2:type="dateTime"
dt:type="DateTime" />

and add the appropriate xmlns declarations to the
Schema element,

<Schema
xmlns="urn:schemas-microsoft-com:xml-data"

xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:dt="urn:schemas-microsoft-com:xml:datatypes"
xmlns:sql2="urn:schemas-microsoft-com:mapping-schema"
xmlns:sql="urn:schemas-microsoft-com:xml-sql" >

I'd also refer you to Daniel Cazzulino's solution on SQL XML
(one difference is it employs an XML Schema document as the
mapping schema, not an XDR),

http://www.sqlxml.org/faqs.aspx?faq=67


HTH,

Derek Harmon


Nov 12 '05 #2

Post your reply

Help answer this question



Didn't find the answer to your .NET Framework question?

You can also browse similar questions: .NET Framework