XMLDocument messing up character references
File in: compute = "...page.
o When you use the “Create Form” function ..."
Do...
FileStream outfs = new FileStream(tempOutXmlFileName, FileMode.Open, FileAccess.Read,
FileShare.ReadWrite);
XMLDocument.Load(outfs)
File After Loading: compute = "...page.
o When you use the "Create Form" function ..."
When it comes time to write out the file again, I use
using (StreamWriter writer = new StreamWriter(tempOutXmlFileName, false, Encoding.GetEncoding("ISO-8859-1")))
{ //(The original file is ISO-8859-1 encoding.)
writer.NewLine = "\n";
xmlOut.Save(writer);
}
and it doesn't seem to know not to write the "
s directly, which is what I'd expect. Ideally I'd like to not have XMLDocument convert them, but if there's something I can do when writing it out, that would be okay, too.
Surely somebody has encountered problems like this before? I was able to work around it a littl开发者_开发百科e before by doing 100% byte operations, but I'd like not to do that here since I need the XML document traversal functions.
Ideas? Suggestions?
Thank you.
Resolution:
I ended up just doing a find/replace. Not pretty, but it does the job and I have some leeway with efficiency.
Unfortunately, what you want to do is going to be difficult. This is the intended behavior. As far as the actual information in the XML, there is no difference - it's just a detail of serialization.
Check out this answer; it's good and addresses your question.
Why is it important to write out the quotation marks as entities?
精彩评论