[xml] Add new pretty-printing and sorting options for saving XML



libxml developers,

Please find for your consideration a series of patches to add 2 new
"xmlSaveOption"s to libxml.

XML_SAVE_WSNONSIG is a new pretty-printing format which adds whitespace
*within* tags, where permitted by the XML standard, to re-line and
indent XML files, without changing any element content at all. No
whitespace is added to, removed from, or altered in any text node of
the document, and no text nodes are are added or removed either.

XML_SAVE_SORT is an option which sorts XML nodes whose order is
unimportant to XML files. This includes the order of attributes within
elements, the order of namespace declarations within elements, and
element, attribute & entity declarations within doctypes.

The idea of these options is to be able to combine them to produce a
"canonical", nearly line-oriented format for XML files.

The goal is to be able to produce XML files which can be manipulated
with standard POSIX-style command-line tools much better than is
currently possible, particularly by diff(1) and patch(1). Of course,
once diff and patch can work effectively on XML files (something that
they currently do very badly at) then revision control systems
(e.g. git) will get much better at storing and merging them too -
particularly if combined with hooks to enforce the canonical style.

Please let me know what you think of the idea and patches. Are they
suitable for libxml? At all? With work? (If so, what?)

Thanks,

Adam Spragg




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