I've following decimal entities 	
and
for TAB and NEWLINE characters in attributes in XML file.
After processing the file and saving, above decimal entities are replaced with its hexadecimal equivalents i.e 	
and 

respectively.
Content in file before processing,
<car id="wait for the signal then proceed 	">
Content after processing the file,
<car id="wait for the signal 

 then proceed 	">
XmlWriter code block i used,
XmlWriterSettings xmlWriterSettings = new XmlWriterSettings
{
Indent = true,
Encoding = encoding,
NewLineHandling = NewLineHandling.Replace
};
XmlDataDocument xmlDataDocument = new XmlDataDocument
{
PreserveWhitespace = true
};
xmlDataDocument.LoadXml(xmlString);
using (XmlWriter writer = XmlWriter.Create(filepath, xmlWriterSettings))
{
if (writer != null)
{
xmlDataDocument.Save(writer);
}
}
Note: I'm aware that having either decimal or hexadecimal entity in XML file, both case should work.
But i'm specifically looking for solutions to retain the same decimal entities after processing the file.
any help one this is much appreciated.
question from:
https://stackoverflow.com/questions/65879535/decimal-entities-replaced-by-hexadecimal-entities-in-c-sharp-xml 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…