ldn-softdev / jtm

HTML/XML to JSON converter
MIT License
45 stars 5 forks source link

Conversion back to XML does not observe attribute order in <?xml> declaration #5

Open geert56 opened 4 years ago

geert56 commented 4 years ago

Officially, an XML declaration requires its attributes to be in the order: version, encoding, and then standalone. See for instance: https://xmlwriter.net/xml_guide/xml_declaration.shtml. Unfortunately, jtm seems to store all attributes in a data structure that does not preserve order, which is perfectly all right for any regular element's attributes.

A simple fix is to ensure that upon output of the XML declaration, its attributes are forced to be in the correct order.