Writing files

I have some data that I'm writing as XML, but the file size is a little large. I was looking for a way to compress the size some. I've read about things like encoding and such, but I'm not all that experienced in file input and output. Is there a good, standard way to drop the file sizes while maintain the same contents?
Do you need to output an XML file? If so then all you possibly can do to decrease its size is to (1) remove formatting (whitespaces), and (2) make names of elements/attributes shorter. You could also pack the generated file.
I need the XML data, how it's stored could be irrelevant if I user a parser that parses an XML string, which is my plan. What the data looks like in the file, I don't really care. I just need to be able to pull it back out in a string of valid XML. Does that make sense?
closed account (zb0S216C)
You could try the TinyXML library; see what that has to offer.
How about just compressing the file. Text files compress nicely! .zip, .tgz, etc...
Can I compress it in my program?

What I'm looking for is that I want to be able to load and save data for my program, and I want to use XML, but there is quite a bit of data, so I want to make the file size smaller while still using XML.

Does that make sense?

It does. I've never used one but there are compression libraries out there. Maybe try libbzip2?
Topic archived. No new replies allowed.