Feature #1290

Updated by Brecht De Man over 9 years ago

For nice viewing of the output XML files, some whitespace/indentation is in order. Recent versions of Safari display XML quite nicely, any other text editor I'm using displays everything as a single line. Shouldn't be very hard.

I've got this much in Python to do the same thing (mostly pseudocode) before I realised I'm suppose to write a PhD. And also it would make more sense if the JavaScript just generated it properly from the start.

@#!/usr/bin/python@

@import os@

@ # get every XML file in folder@
@for file in os.listdir("."): # You have to put this script in folder where output XML files are.@
@ if file.endswith(".xml"):@
@ # read in each line as single string@
@ # for each line:@
@ # at every '<...>'@
@ # increase variable 'indentation'@
@ # enter new line afterwards [if immediately '<' afterwards, or in other words except if next one is corresponding </ ...>]@
@ # at every '< / ...>'@ &#x27;&lt;/...&gt;&#x27;@
@ # decrease variable 'indentation'@
@ # enter new line afterwards@
@ # at every '<... />'@
@ # enter new line afterwards@

(Sorry indentation is not showing in preview)

Back