Proper whitespace formatting in mini_xml_karma.cpp example code

Maarten Verhage <[email protected]> Tue, 17 Apr 2018 06:52:51 +0000
Newsgroups gmane.comp.parsers.spirit.general
Message-ID <AM5P192MB013148B41912F1E69D2A565CBAB70@AM5P192MB0131.EURP192.PROD.OUTLOOK.COM>
Dear people,

I'm using some CAD software tool that produces output that looks a bit like 
xml. Certain values that are produced in these files are undesired in my 
perspective. So I wish to change them automatically. Therefore I was 
thinking that the mini_xml_karma example code of Spirit 2.5.3 is a good 
starting point to write such an utility program. Correct?

I've done some stuff with Spirit in the past but you still should consider 
me a novice on this topic.

Regarding the mini_xml_karma example code I managed to write the result to a 
file. However the whitespace is removed from it, as was the case with the 
original output to std::cout.

My next objective is to generate proper whitespace. I've no need the 
preserve the original line numbers so I can define my own formatting style 
for this. I think something like the formatting of the "3.toyxml" file would 
be fine. So, top hierarchy start tags should have a line feed directly after 
it. Any line that follows should have indentation of some spaces until the 
end tag. Subsequent start/end tags should be on the same line.

Do you know of some example code that shows behavior like this? Or which 
Spirit and/or Karma facilities should I be using to implement this?

Thank you very much for your attention and time!

Best regards,
Maarten Verhage 


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot