Feature #1290
Updated by Brecht De Man over 10 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@ #!/usr/bin/python
@import os@ import os
@ # get every XML file in folder@ folder
@for for file in os.listdir("."): # You have to put this script in folder where output XML files are.@
@ are.
if file.endswith(".xml"):@
@ file.endswith(".xml"):
# read in each line as single string@
@ string
# for each line:@
@ line:
# at every '<...>'@
@ '<...>'
# increase variable 'indentation'@
@ 'indentation'
# enter new line afterwards [if immediately '<' afterwards, or in other words except if next one is corresponding </ ...>]@
@ ...>]
# at every '</...>'@
@ '</...>'
# decrease variable 'indentation'@
@ 'indentation'
# enter new line afterwards@
@ afterwards
# at every '<... />'@
@ />'
# enter new line afterwards@
(Sorry indentation is not showing in preview) afterwards
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@ #!/usr/bin/python
@import os@ import os
@ # get every XML file in folder@ folder
@for for file in os.listdir("."): # You have to put this script in folder where output XML files are.@
@ are.
if file.endswith(".xml"):@
@ file.endswith(".xml"):
# read in each line as single string@
@ string
# for each line:@
@ line:
# at every '<...>'@
@ '<...>'
# increase variable 'indentation'@
@ 'indentation'
# enter new line afterwards [if immediately '<' afterwards, or in other words except if next one is corresponding </ ...>]@
@ ...>]
# at every '</...>'@
@ '</...>'
# decrease variable 'indentation'@
@ 'indentation'
# enter new line afterwards@
@ afterwards
# at every '<... />'@
@ />'
# enter new line afterwards@
(Sorry indentation is not showing in preview) afterwards