My Code:
using (XmlTextReader inputReader = new XmlTextReader(xml, XmlNodeType.Document, new XmlParserContext(null, null, "en", XmlSpace.Default)))
{
XsltArgumentList arglist = new XsltArgumentList();
GetXSLT().Transform(inputReader, arglist, outputStream);
}
The XmlTextReader
is created fine, inside the XML there is an entity reference for a vertical tab (
)
The line that errors is the call to Transform. It says that there is an invalid XML character (the vertical tab of course).
I've tried using the approach referenced in the following article:
Escape invalid XML characters in C#
My question is: how can I remove or ignore the invalid characters using the .NET framework like the link states?
note: in a way that doesn't involve hard coding a list of entity references to replace (I'm already doing this and it is horrible and I feel bad, and I should)