Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

XDocument.ToString() throwing "' ', hexadecimal value 0x13, is an invalid character." exception

I want to store XDocument into the SQLXML Datatype. I went through this Link for storing XDOcument into the SQL DB. As per the link while Converting XDocumentObj.ToString() its throwing "' ', hexadecimal value 0x13, is an invalid character." exception. Can anyone please help me to fix the problem. How do I store the complete XML file into the database of type XML.

like image 482
SharpUrBrain Avatar asked Dec 18 '25 03:12

SharpUrBrain


1 Answers

Somehow you got the character U+0013 in there, which is a control character for pausing transmission on serial datalinks. It's unlikely you actually want that, so the real issue isn't that there's a character that's invalid in XML in there, but that there's a character that just shouldn't be there, in there. So find out how it got in there, as that were the real bug is. I'd start by trapping whatever calls add to the document, and throwing when you find a string containing U+0013

like image 59
Jon Hanna Avatar answered Dec 19 '25 18:12

Jon Hanna



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!