Unicode escape characters not being read by XmlReader

Posted by craigmoliver on Stack Overflow See other posts from Stack Overflow or by craigmoliver
Published on 2010-05-14T14:01:14Z Indexed on 2010/05/14 14:04 UTC
Read the original article Hit count: 311

Filed under:
|
|
|

I've got an XML document that I'm importing into an XmlReader that has some unicode formatting I need to preserve. I'm preserving the whitespace but it's dropping the encoded #x2028 which I assume should be expressed as a line break.

Here's my code:

var settings = new XmlReaderSettings
                   {
                       ProhibitDtd = false,
                       XmlResolver = null,
                       IgnoreWhitespace = false
                   };

var reader = XmlReader.Create(new StreamReader(fu.PostedFile.InputStream), settings);
var document = new XmlDocument {PreserveWhitespace = true};
document.Load(reader);
return document;

© Stack Overflow or respective owner

Related posts about Xml

Related posts about c#