String parsing difference in XML and ADO

csharp_boy

Member
Joined
Feb 5, 2006
Messages
5
Hi

I came across this, and thought it was interesting.

Say I have a table "Table1" with a column "xmlData" of type XML .

Now using ADO.NET, I can drag out rows from this table into a DataSet.

If I have a row Row1 in Table1, and the column xmlData was <name="tim">, dragging it out onto the dataset, i would get this <name=\"tim\">

The \ are there to just tell the compiler that the " is not the end of the string.

Anyway, if i choose to insert this row back into the table, say with a storedProc1 that takes in a parameter xmlData of type xml

this will cast an error because the \ is stuffing up the format of the XML

i will get this error

XML parsing: line 1, character 30, A string literal was expected


Has anyone encountered this? and what is the best way to handle this.

I just foudn this really weird that they would allow data to be dragged out, that cant be inserted back into the table without modification.

Ive found by replacing \* with \ in the xmlData fixes it.

However, this does not sound like a clean solution.
 
Back
Top