Reputation: 430
How can I avoid XmlDocument class replace ' entity with the ' character? For example if I have:
string xml = "<a> ' </a>";
After doing
var doc = new XmlDocument();
doc.LoadXml(xml);
string output = doc.OutterXml;
The value of output is
"<a>'</a>"
I need to avoid this because I must load an XML, make some changes and sign it digitally so the signed XML must be the same loaded.
Upvotes: 0
Views: 693
Reputation: 74929
For your specific requirements, don't use XmlDocument
or any other XML parser to parse the original document.
Do use XmlDocument
or any other XML-specific classes to create your new document, except put a placeholder where the original document needs to go, like ORIGINAL_DOCUMENT_HERE
. Then after you've generated the resulting text XML for your new document, replace ORIGINAL_DOCUMENT_HERE
with your original received text, and then sign the result.
Not a normal way to work with XML, but should work for your specific use case.
Upvotes: 1