[xml] XML tree indention - Switching it off...



Hi....

When writing out an xml to a file or in memory there are functions like:

xmlDocDumpFormatMemory()
xmlDocDumpFormatMemoryEnc()
xmlDocFormatDump()
xmlSaveFormatFile()
xmlSaveFormatFileEnc()

All these functions allow to specify a parameter "format"
to influence xml formatting. Unfortunately you only have 2 options.
0 = write out xml pretty formatted in multiple lines.
1 = write out xml all in one line without spaces.

What I would need would be a function to switch of indenting, but
keep multiline output. I want to keep xml files in a compact fashion
checked into a versioning system. To keep track of changes I need
multiline output, but I also need them unindented to save space and
make the changes easier diffable.

At present I only found a global variable (xmlTreeIndentString) to switch
off the indention, but that is not really nice. It globally influences the whole
system. It would imho be better to have a decision to switch indention off
on a per document/save operation level. What might be possible without a significant
change in the API would be to expand the format parameter to have
an additional value:
2 = write out multilined, but unindented.

What do you think? Would that be a possible way to go? Or
are there other ways I am too stupid to find to influence the indention
of a created xml on a per document/save operation level?

Thanks,

Roland




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]