theopensystemslab/planx-new

Generated XML is invalid

Closed this issue · 2 comments

Currently, xml generation appends the XML declaration to the bottom of the document resulting in invalid XML.

This is causing failures in uniform uploads but also in downloading the xml file:
image

Possibly related to #1450

The order of declarations is not preserved in #1450 and the schema explicitly validates documents with XML declaration at the end of the document.

The xml parser library behaves in an slightly unexpected way when attempting to preserve the order of the input. The example site has a playground to understand this behavior (check the preserve order option and translate back and forth to see the issue): https://naturalintelligence.github.io/fast-xml-parser/

Resolved by #1495