Wednesday, March 28, 2012

Invalid XML Elements found inside cync block

I'm receiving the following error when attempting to execute an
updategram using SQL 2005 and SQLXML 4.0
FrostingModel.Tests.Artist.InvalidConcurrencyUpdate :
Microsoft.Data.SqlXml.SqlXmlException : HRESULT="0x80004005"
Description="Invalid XML elements found inside sync block"
Here is my updategram.
<u>
<updg:sync mapping-schema=".\Schemata\Artist.xsd" nullvalue="NULL"
xmlns:updg="urn:schemas-microsoft-com:xml-updategram">
<updg:before>
<ns1:Artist updg:id="0" ArtistID="1716"
UpdateStamp="AAAAAAAADUw=" xmlns:ns1="urn:Frosting" />
</updg:before>
<updg:after>
<ns1:Artist updg:id="0" ArtistID="1716" Name="Blah Blah Update"
xmlns:ns1="urn:Frosting" />
</updg:after>
</updg:sync>
</u>
And here is the accompanying schema:
<xsd:complexType name="Artist">
<xsd:attribute name="ArtistID" type="xsd:int" use="required"
sql:identity="ignore" sql:datatype="int" />
<xsd:attribute name="Name" type="xsd:string" use="optional"
sql:datatype="nvarchar" />
<xsd:attribute name="UpdateStamp" use="optional" dt:type="bin.hex"
sql:datatype="timestamp" sql2:concurrency="UseValue" />
</xsd:complexType>
It should be noted that if I use concurrency on the Name attribute, it
works as expected. However I would prefer to use a timestamp - it's
the timestamp that seems to be the big proverbial pain in the arse.
I can't seem to find any solutions online regarding this problem... any
takers?
- ryan.Okay...
I changed my UpdateStamp value to be something like 0x000000000000101A
and the updategram worked as expected. However this doesn't make any
sense, because SQL 2005's FOR XML EXPLICIT returns the timestamp value
in a 12 character format such as "AAAAAAAADUw=", not in the above
format.
Am I missing something, or is this a bug in SQLXML 4.0 / SQL 2005? How
is it that SQL 2005 can emit a timestamp value in that "AAA..." format,
but it can't accept it? Do I have to do some type of conversion on my
client side after I receive the timestamp value from sql server?
Any help would be appreciated,
- cranley
cranley wrote:
> I'm receiving the following error when attempting to execute an
> updategram using SQL 2005 and SQLXML 4.0
> FrostingModel.Tests.Artist.InvalidConcurrencyUpdate :
> Microsoft.Data.SqlXml.SqlXmlException : HRESULT="0x80004005"
> Description="Invalid XML elements found inside sync block"
> Here is my updategram.
> <u>
> <updg:sync mapping-schema=".\Schemata\Artist.xsd" nullvalue="NULL"
> xmlns:updg="urn:schemas-microsoft-com:xml-updategram">
> <updg:before>
> <ns1:Artist updg:id="0" ArtistID="1716"
> UpdateStamp="AAAAAAAADUw=" xmlns:ns1="urn:Frosting" />
> </updg:before>
> <updg:after>
> <ns1:Artist updg:id="0" ArtistID="1716" Name="Blah Blah Update"
> xmlns:ns1="urn:Frosting" />
> </updg:after>
> </updg:sync>
> </u>
> And here is the accompanying schema:
> <xsd:complexType name="Artist">
> <xsd:attribute name="ArtistID" type="xsd:int" use="required"
> sql:identity="ignore" sql:datatype="int" />
> <xsd:attribute name="Name" type="xsd:string" use="optional"
> sql:datatype="nvarchar" />
> <xsd:attribute name="UpdateStamp" use="optional" dt:type="bin.hex"
> sql:datatype="timestamp" sql2:concurrency="UseValue" />
> </xsd:complexType>
> It should be noted that if I use concurrency on the Name attribute, it
> works as expected. However I would prefer to use a timestamp - it's
> the timestamp that seems to be the big proverbial pain in the arse.
> I can't seem to find any solutions online regarding this problem... any
> takers?
> - ryan.

No comments:

Post a Comment