xmlformatter
xmlformatter copied to clipboard
xmlformatter removes attributes with empty value
Hi, Thanks for writing this package. I ran xmlformatter the other day on some XML and it removed an attribute with empty value. This caused a serious problem later because some other code expected the attribute to be there and crashed when it wasn't. The existence of an attribute is part of the information in an XML document. A formatter should not decide to remove them. Here is a distilled example of the issue:
In [7]: xml = '
In [8]: formatter = xmlformatter.Formatter(indent="2", ...: indent_char=" ", ...: encoding_output="ISO-8859-1", ...: preserve=["literal"])
In [9]: formatter.format_string(xml)
Out[9]: '