Make XmlWriter output single quotes, not double quotes around attribute values

Is there a way to make XmlWriter output single quotes rather than double quotes when writing attributes?

I'm not interested in XmlTextWriter , which has a QuoteChar property (as if not part of XmlWriterSettings ). In addition, redefinition of any existing writer class is actually impossible, except possibly for packaging it.

Reason for the request: I output json in the html data attributes, because the json quote character "this easily leads to a small explosion of data due to the" slipping away "everywhere. If I could use a single quote to start the attribute value, double the json quote would not require escaping.

I output (x) html, and according to questions like this , single quotes are legal for delimiting attribute values.

I'm sure there is no (normal) way to do this, but who knows that I missed something.

+4
source share

All Articles