openframeworks / openframeworks/openFrameworks
Reducing bloated output from ofxXmlSettings (suggestions)
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 10.4k
- Forks
- 2.6k
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 9
Description
I realize it's dumb to complain about XML being bloated ("then don't use it!) but:
There are some simple things we could add to reduce the bloating of output produced by ofxXmlSettings, particularly for large files.
The first is to allow floatPrecision in ofxXmlSettings.cpp to be user-adjusted. There are times when I really don't need to know fractions. out to 9 places. This could be another argument passed in to XML.setValue(), or it could be a global variable that's adjusted by the user.
Likewise, I don't see why tinyxml.cpp hardcodes four spaces for indents. I'd like the option of using tabs, or an adjustable number of spaces. There are a number of functions called Print in tinyxml.cpp that would need to be changed:
fprintf( cfile, " " );
which could optionally be replaced with tabs, i.e.
fprintf( cfile, "\t" );
Testing would need to be done to ensure that the files could still be read, of course.
These changes would allow a very large reduction in file size, without compromising the value of the XML output.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading ofxXmlSettings.cpp to understand how floatPrecision is currently used, then inspect the Print functions in tinyxml.cpp that hardcode four-space indentation. Decide how the precision and indentation options should be exposed, and verify that generated files remain readable after both changes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, xml
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100