Get File Size of XmlDocument

  • Thread starter Thread starter Saurabh Sharma
  • Start date Start date
S

Saurabh Sharma

Hi

I am making a XmlDocument . How can i check the Size of the file size of
XmlDocument when i will save it to the disk.

Regards
Saurabh Sharma
 
Saurabh said:
Hi

I am making a XmlDocument . How can i check the Size of the file size of
XmlDocument when i will save it to the disk.

Regards
Saurabh Sharma

use OuterXml to get the xml in a string,
and then the Length of that string.
Should give a good estimate?

The actual resulting filesize depends on encoding:
if you use UTF-16 then every character is (at least) two bytes.
 
Thanx Hans that will give a rough estimate and in my case it will work

Regards
Saurabh Sharma
 
Remember though that the size of the file is not necessarily the number of
character in the XML since XML support Unicode which is a multi-byte
encoding.
 
Back
Top