wcmio-content-package-maven-plugin:download - Disable reordering of xmlns-attributes

Description

Result from using the tool:

It appears that xmlns attributes are sorted by alphabet, causing changes to be seen in Git.

Activity

Show:
Stefan Seifert
August 10, 2017, 6:48 AM

this is difficult to fix. the original namespace ordering is not preserved when parsing the XML with JDOM2, and i'm not sure what rules are followed to build the original ordering in the AEM package.

patches welcome!

Henry Kuijpers
August 15, 2017, 7:57 PM

It looks like the order of the attributes is the order of whichever one comes first in the document. (Either as an attribute namespace (i.e. jcrrimaryType - namespace 'jcr') or as a value (i.e. jcrrimaryType="nt:unstructured" - namespace 'nt')

Stefan Seifert
August 24, 2017, 12:54 AM

i've implemented a solution in https://github.com/wcm-io/wcm-io-tooling/commit/fd225c788371140653fc538f58e57b2b3fd25d78
using a separate parsing step to get the original order of xmlns definitions.

Henry Kuijpers
August 24, 2017, 1:15 AM

Very cool!

I didn't have a lot of time, but I started digging into how the XML is being created; But didn't get very far yet.

I was indeed also thinking about a solution that would just get the original xmlns's and put them back.

One disadvantage is of course that some namespaces will still be there, even if all properties/mixins of their type are removed from the document.

Fixed

Assignee

Unassigned

Reporter

Henry Kuijpers

Labels

None

Components

Fix versions

Affects versions

Priority

Major