Someone can help me, I had in a XMLDocument variable the following:
I want to save to a file in the following format:
I use docXML.Save(file) but the first format is preserve. How can i do to resolv the problem?
Regards
Prasad RaveendranPosted Nov 21, 2023, 11:45 PM
The issue is that the
comprobantetag's content has XML escape sequences<and>instead of the actual<and>characters. You'll need to decode these escape sequences back to their original form before saving the document. Here's an example in C#:This code uses
System.Net.WebUtility.HtmlDecodeto decode the HTML-encoded content within thecomprobantetag. After that, it replaces thecomprobantetag's inner XML with a CDATA section and saves the modified XML document to a file.Make sure to include necessary error handling and modifications based on your exact use case, such as specifying the proper file paths and handling any exceptions that may occur during file operations.