Question

I'm working with Linq to xml, and I save my xml in a standars text field in one ordanary SQL database.

Now to my problem: I want to be able to sync the things I save in my SQL text field with a field in TFS. The problem is when I save the xml which is a string, my TFS field removes all the xml tags, and when I query my tfs field again I get back the text in my xml without the xml tags, but with the <body> at the begining and </body> in the end?

I'm saving the text to the field in code using this:

workItem["Customer.CustomerXMLTalk"] = newXMLTalk.ToStringWithDeclaration();

What do I have to change with my TFS field inorder to be able to save the xml as a string without loosing my tags.

Thanks!

Was it helpful?

Solution

Try HTML Encoding the string before you save it.

workItem["Customer.CustomerXMLTalk"] = 
      System.Web.HttpUtility.HtmlEncode(newXMLTalk.ToStringWithDeclaration());
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top