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

On Tue, Oct 05, 2010 at 10:22:22PM +0100, Adam Spragg wrote:
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.

  Still *any* text node is significant in XML. Any indenting is by
definition destructive.

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.

  there is already an implementation in libxml of C14N which is the
official W3C standard for canonical XML, it exists and is deployed and
used for nearly 10 years, including for digital signatures of XML.
  Why implement a second implementation which has no standardization
at all ?

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

  The main problem from my POV is you started developping those patches
apparently without fully understanding the current state of the art and
code, and unfortunately this looks like a lot of wasted efforts :-\
  I don't like to turn down contributions but in this case, I afraid it
would add more confusion than really improve the user experience.
See xmllint options:
    --c14n : save in W3C canonical format v1.0 (with comments)
    --c14n11 : save in W3C canonical format v1.1 (with comments)
    --exc-c14n : save in W3C exclusive canonical format (with comments)


Daniel Veillard      | libxml Gnome XML XSLT toolkit
daniel veillard com  | Rpmfind RPM search engine | virtualization library

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