Home > Archive > MS SQL XML > May 2005 > How to insert data with dollar ($) first with sqlxml ?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author How to insert data with dollar ($) first with sqlxml ?
Pierre CHALAMET

2005-05-27, 3:23 am

Hi,

I wish to insert the following data into an sql table using sqlxml. All
columns in the table are varchar. The crafted xml is as follow:

<ROOT xmlns:updg="urn:schemas-microsoft-com:xml-updategram">
<updg:sync><updg:after>
<temp_Outstanding drawdownApp="LOA"
drawdownId="XYZ"
facilityId="$J5EZEFN">
</temp_Outstanding>
</updg:after></updg:sync>
</ROOT>

But this lamely fail with the following error: Invalid XML elements found
inside sync block (HRESULT="0x80004005").

The code to perform the update is as follow:
SqlXmlCommand cmd = new SqlXmlCommand(conn);

cmd.CommandType = SqlXmlCommandType.UpdateGram;
cmd.CommandText = content;
stm = cmd.ExecuteStream();


The trouble seems to come from the $J5EZEFN field. Is there a way to insert
something into a table that begin with a dollar ($) sign ?

It seems that $XXX is used to pass parameters - but, well, I do not want to
pass parameter. I just want to insert a data with a dollar ($) first.

Is there a way to do this without using stored procedure and altering the
data ?

Thanks,

- Pierre


Geoff Ely

2005-05-27, 9:23 am

A brief discussion on handling "invalid XML data" is covered here:

http://msdn.microsoft.com/library/d...tegram_375f.asp

Check section:

C. Dealing with valid SQL Server characters that are not valid in XML

- good luck,
Geoff -

"Pierre CHALAMET" wrote:

> Hi,
>
> I wish to insert the following data into an sql table using sqlxml. All
> columns in the table are varchar. The crafted xml is as follow:
>
> <ROOT xmlns:updg="urn:schemas-microsoft-com:xml-updategram">
> <updg:sync><updg:after>
> <temp_Outstanding drawdownApp="LOA"
> drawdownId="XYZ"
> facilityId="$J5EZEFN">
> </temp_Outstanding>
> </updg:after></updg:sync>
> </ROOT>
>
> But this lamely fail with the following error: Invalid XML elements found
> inside sync block (HRESULT="0x80004005").
>
> The code to perform the update is as follow:
> SqlXmlCommand cmd = new SqlXmlCommand(conn);

> cmd.CommandType = SqlXmlCommandType.UpdateGram;
> cmd.CommandText = content;
> stm = cmd.ExecuteStream();
>
>
> The trouble seems to come from the $J5EZEFN field. Is there a way to insert
> something into a table that begin with a dollar ($) sign ?
>
> It seems that $XXX is used to pass parameters - but, well, I do not want to
> pass parameter. I just want to insert a data with a dollar ($) first.
>
> Is there a way to do this without using stored procedure and altering the
> data ?
>
> Thanks,
>
> - Pierre
>
>

Pierre CHALAMET

2005-05-27, 8:24 pm

XXX is perfectly valid in xml and even encoding this as &x36; does not solve
any problem. I strongly believe that $XYZ is reserved for parameter.

Is there a way to disable parameters in this kind of xml ? I just want to
know how to espace dollar ($) when used as 1st char in a field.

- Pierre




"Geoff Ely" wrote:
[color=darkred]
> A brief discussion on handling "invalid XML data" is covered here:
>
> http://msdn.microsoft.com/library/d...tegram_375f.asp
>
> Check section:
>
> C. Dealing with valid SQL Server characters that are not valid in XML
>
> - good luck,
> Geoff -
>
> "Pierre CHALAMET" wrote:
>
Amar Nalla [MSFT]

2005-05-27, 8:24 pm

The problem is that when the Updategram does not have an associated
mapping-schema, the Updategram processor treats the "$" sign as a special
currency symbol and expects a numerical value after it.
As far as I know the workaround is to use a mapping schema.

Thank you,
Amar Nalla [MSFT]
PS: This posting is provided "AS IS" and confers on rights or warranties
"Pierre CHALAMET" < PierreCHALAMET@discu
ssions.microsoft.com> wrote in
message news:B82E01B2-B043-4E32-9048- ADF49C469805@microso
ft.com...[color=darkred]
> XXX is perfectly valid in xml and even encoding this as &x36; does not
> solve
> any problem. I strongly believe that $XYZ is reserved for parameter.
>
> Is there a way to disable parameters in this kind of xml ? I just want to
> know how to espace dollar ($) when used as 1st char in a field.
>
> - Pierre
>
>
>
>
> "Geoff Ely" wrote:
>


Pierre CHALAMET

2005-05-28, 9:23 am


I think I could not provide a mapping schema. The reason is that I'm using
BizTalk Server 2004 with an SQL send port (which does use sqlxml behind the
scene).

Since I'm having a bug with an orchestration because of a bad placed dollar
I sadly thought this could be solved easily with the understanding of sqlxml
behaviour.

I'll go back to biztalk server newsgroup so...

- Pierre
Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com