N
not_a_commie
Here is my goal:
1. Read in a (really large) UTF8 XML document.
2. Put a certain element in that document into a byte[] still encoded
in UTF8.
3. Avoid ever converting the document or any of its significant
children into UTF16.
If I load my document using an XmlReader passed into XDocument.Load
(or XmlDocument.Load) does it leave it in the original format until I
call some method that returns a string? Is there some type of reader
that would have this behavior?
As far as extracting the element, my first thought was to use an
XmlWriter into a MemoryStream (with the above assumption that my
document hadn't already been converted into UTF16). However, I can't
get an appropriately-sized byte[] out of it that way without making a
copy after I've written the data. Hence, I've used at least 2x memory
anyway with that approach. Any ideas?
1. Read in a (really large) UTF8 XML document.
2. Put a certain element in that document into a byte[] still encoded
in UTF8.
3. Avoid ever converting the document or any of its significant
children into UTF16.
If I load my document using an XmlReader passed into XDocument.Load
(or XmlDocument.Load) does it leave it in the original format until I
call some method that returns a string? Is there some type of reader
that would have this behavior?
As far as extracting the element, my first thought was to use an
XmlWriter into a MemoryStream (with the above assumption that my
document hadn't already been converted into UTF16). However, I can't
get an appropriately-sized byte[] out of it that way without making a
copy after I've written the data. Hence, I've used at least 2x memory
anyway with that approach. Any ideas?