You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 19, 2026. It is now read-only.
What steps will reproduce the problem?
1. Serialize a value with special characters like "<", "&", """, ...
What is the expected output? What do you see instead?
For "&" I expect "&" etc
Instead of an xml error when loading the string in a xml document
What version of the product are you using? On what operating system?
r115, XP, .NET 4
Please provide any additional information below.
To Fix reading, just rewrite NullFieldDefinition.cs
public object Convert(object value)
{
return value;
}
to
public object Convert(object value)
{
if (value.GetType() == typeof(string))
{
value = HttpUtility.HtmlDecode(value.ToString());
}
return value;
}
In my opinion value should always be a string object. But I didn't wrote
the framework... maybe the if is not needed
To Fix writing, just rewrite NXmlNodeWriter.cs
public void AddAttribute(string attributeName, string value)
{
if (streamWriter != null)
{
streamWriter.Write(string.Format(" {0}=\"{1}\"", attributeName,
value));
}
}
to
public void AddAttribute(string attributeName, string value)
{
if (streamWriter != null)
{
value = HttpUtility.HtmlEncode(value);
streamWriter.Write(string.Format(" {0}=\"{1}\"", attributeName,
value));
}
}
Original issue reported on code.google.com by kue...@gmail.com on 12 Mar 2010 at 3:10