Get File Size of XmlDocument

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
 
H

Hans Kesting

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.
 
S

Saurabh Sharma

Thanx Hans that will give a rough estimate and in my case it will work

Regards
Saurabh Sharma
 
P

Peter Rilling

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top