John, hello.
On 3 Aug 2018, at 16:12, John Dziurlaj wrote:
> These fragments have repeating elements, and I worry that parsers /
> writers
> may rewrite the fragments such that the order of their sub elements
> may
> change, making comparison difficult. Is this a valid concern, and what
> can
> I do about it?
An XML parser is permitted to report _attributes_ in any order, but a
parser is emphatically not permitted to reorder elements.
A particular XML-parser library might, for its own specialised (speed?)
reasons, choose to ignore this, and an application layer above the
parser may elect to regard differently-ordered child elements as
equivalent, but the ordering of elements (but not attributes) is in
general a significant property of an XML document.
If you want to normalise XML fragments, that's a separate issue.
Best wishes,
Norman
--
Norman Gray : https://nxg.me.uk