Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-1542

Irregular ordering of document XML fields during export

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.1 M3
    • Fix Version/s: 1.1 M4
    • Component/s: {Unused} Core
    • Labels:
      None
    • keywords:
      export, XML, field ordering, patch
    • Similar issues:

      Description

      I've talked to Vincent about this a few times, I know it bugs him, too.

      Any time you export a document to XML, the fields/objects/classes can come out in a different order. If you're working on a document-based application, for example, this seemingly harmless field flipping can make it very difficult to figure out what actually changed, and what didn't.

      I've attached a patch that imposes a sort order on fields when rendered to XML (via iterators and comparators), in one case, I substituted a TreeMap for a vanilla HashMap to get intrinsic sorting of keys. The implementation is fairly clean: one new method on BaseCollection to get an iterator that will walk over the fields in a sorted collection. Fields are sorted by name (the getName method on the ElementInterface).

        Attachments

          Activity

            People

            Assignee:
            sdumitriu Sergiu Dumitriu
            Reporter:
            ebullient Erin Schnabel
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Date of First Response: