Click here to Skip to main content
15,912,578 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
See more:
I have developed an application which uses xml file as a datasource . but i don't know any limitations of the xml file usage.

I want to know the limitations of the xml file according to the size of the xml data. because i'd searched on google & i got result like xml is not useful when the xml data size is out of limit that time may be your application will show error like "stack overflow" . but i'm unable to finding that limit of the xml data.



can anybody help me?

thanx....
Posted

As far as I know there is no actual limit set anywhere. The useable limit would depend on too many factors to be easily calculated and would include the depth of the 'tree', system memory and many other factors.

If it were me I would set up an Application that could insert a given number of 'records' (say 1000 or 10000 at a time) into a test file and keep trying to use that file, then adding more records, until your application becomes unusable or you get a StackOverflowException. Go back one step and regard that as the maximum size.
 
Share this answer
 
XML itself certainly does not set any size limit. Your file system however might have a file size limit. And if you want to process your XML files then you need to be aware that APIs like System.Xml.XmlDocument or System.Xml.Linq.XDocument build an in-memory tree model of the complete XML document so the memory consumption of your application will grow with the size of the XML you are trying to process. So in practical terms there is a limit of how much memory your application has available, if you use those APIs.
XmlReader on the other hand works forwards only and pulls in node by node meaning that way the memory consumption does not grow with the size of the XML document.

My recommendation for you is to read and process it in smaller chunks, that it might not handle loading the entire thing into memory at one time. However, if you are trying to WRITE XML as a stream to a final output .XML file, you should be good to go on most current OS that support over 2 gig. But if you have a really huge XML, you might think of using a small database.
 
Share this answer
 
I have found that, as previously stated, the complexity of the tree can have a bearing on the size of the XML file.

In practice I've found that large XML files can cause StackOverflow exceptions. This can be a big problem if you're halfway through processing a large file.

One solution, is to split out your XML files into equal sizes. When de-serialising them it's then possible to create a single list from that information.

Hope that helps,

Laurence
 
Share this answer
 
Like everyone mentioned, there is no hard limit on the xml file size. In the past we found out using xml file above certain size degraded our application. But the size we found was not hard limit size, where as the size that our application started degrading. There was not easy way of finding it. We use Brute Force and Trial and Error to figure out the optimal size for which we could comfortably work with. BTW, our issue was never with Stack Overflow or Out of Memory Exception rather after the certain size we found it took us longer to process the XML file.

Now before you jump and say Aha! in our case here is what we found.
1. We found xxMB was the optimal we could handle
2. Any XML file smaller than xxMB showed no major difference in performance.
3. Any xml file bigger than xxMB, even if by few MB starts the degradation of performance.

p.s
a)Now, I have intentionality did not say what the size was because it is irrelevant to you. You need to find your optimal size.
b) The limitation is not necessary of that of xml file, but how we handle and process things.
 
Share this answer
 
In addition to my answer above, I just came across this CP article How to Open Large XML files without Loading the XML Files?[^]

I know that article will not solve your problem, but you may get an idea from it. I thought it may be helpful.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900