473,405 Members | 2,349 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Get File Size of XmlDocument

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
Nov 16 '05 #1
4 13595
Maybe you can use FileInfo.Length.

"Saurabh Sharma" <sa***********@yahoo.com> wrote in message
news:#w**************@tk2msftngp13.phx.gbl...
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

Nov 16 '05 #2
Saurabh Sharma wrote:
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.

--
Hans Kesting
Nov 16 '05 #3
Thanx Hans that will give a rough estimate and in my case it will work

Regards
Saurabh Sharma
"Hans Kesting" <ne***********@spamgourmet.com> wrote in message
news:OX**************@TK2MSFTNGP10.phx.gbl...
Saurabh Sharma wrote:
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.

--
Hans Kesting

Nov 16 '05 #4
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.

"Saurabh Sharma" <sa***********@yahoo.com> wrote in message
news:u8**************@TK2MSFTNGP10.phx.gbl...
Thanx Hans that will give a rough estimate and in my case it will work

Regards
Saurabh Sharma
"Hans Kesting" <ne***********@spamgourmet.com> wrote in message
news:OX**************@TK2MSFTNGP10.phx.gbl...
Saurabh Sharma wrote:
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.

--
Hans Kesting


Nov 16 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: reddy | last post by:
I am trying to insert a node into an XMLFile. using XMLTextwriter. My Question is Is it possible to do without using XMLDocument. Because its loading all the the file into memory. I just want to...
2
by: John | last post by:
Hi, I need to store the size of my form in a config file. I was saving this in the registry, but I need it in a config file now. I came up with the following code. The part I'm not so sure...
1
by: Brett | last post by:
I often have to change a single value in an xml file based off of a given ID. Is there any easy way to do this through .net.xml? Do I have to parse the file then write it out again?
8
by: Sam Collett | last post by:
Is there a basic guide on Xml document creation and editing (simpler than the MSDN docs). Say I want to create a file containing the following: <?xml version="1.0" encoding="utf-8"...
15
by: janhm | last post by:
Hello. I need to loop through a xml file finding a specific innerxml text and then ad the content to a treeview. For example. If the innerxml im searching for is "item001" then I want the...
11
by: Dorsa | last post by:
HI, Could you please tell me the error in here. I am trying to open an XML file from a link. Response.Clear() Response.Expires = 0 Response.BufferOutput = False Response.ContentType =...
3
by: Debbie Carter | last post by:
Can XML files be easily encrypted?
4
by: SteveW | last post by:
Thanks to some good help from a previous post, I have been able to create well formed xml as part of a report logger app. However, I still have a small problem. When I add new xml to the log file,...
13
by: sherifffruitfly | last post by:
Hi all, I'm trying to distill all of the info from google searches into what I need, with partial success. In truth, the whole xmlNode, Document, Element, etc group of classes & methods is going...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.