[Qt-interest] ç­"复: QDomDocument parser xml

Atlant Schmidt aschmidt at dekaresearch.com
Mon Feb 21 15:42:39 CET 2011


André:

  The case that actually bites us routinely are Qt's own .ui files.
  New versions of Designer tend to gratuitously move-around XML
  attributes, meaning even if your edit was very slight, a new
  version of a .ui file might appear to have many differences.

  (I should have made this clear in my original reply.)

                            Atlant

-----Original Message-----
From: qt-interest-bounces+aschmidt=dekaresearch.com at qt.nokia.com [mailto:qt-interest-bounces+aschmidt=dekaresearch.com at qt.nokia.com] On Behalf Of Andre Somers
Sent: Monday, February 21, 2011 07:13
To: qt-interest at trolltech.com
Subject: Re: [Qt-interest] ç"复: QDomDocument parser xml

Op Ma, 21 februari, 2011 12:47 pm, schreef Atlant Schmidt:
> André:
>
>   Well, I can think of one reason why it would have
>   been nice to keep the attributes ordered:
>
>   Random swapping around of attributes leads to new file
>   versions appearing to be different when they really
>   aren't. This confuses the history maintained by code
>   management systems, leads to extra work (and a greatly-
>   increased likelihood of errors) by the humans doing
>   code review ("Is this a real change or just Qt swapping
>   attributes around? I don't know, we'll have to inspect
>   each attribute individually and hope we correctly assess
>   all of the changes :-(."), and screws up a lot of
>   automation that expects that files don't gratuitously
>   change.

OK, point taken. I think this is only an issue if there are multiple tools
(including non-Qt tools) manipulating XML files that are stored in some
kind of versioning system. That happens, I guess, though I'd guess it's
not such a common use case.

Note that the order of the attributes does not randomly change. If you
load and save the same set of attributes, they will still be in the same
order for an XML file that was written away with QDomDocument. An order is
maintained internally, and though that order may not look "ordered" to the
naked eye, it is in fact ordered*. The order could in theory change
between versions though.

I am not sure if QXmlStreamWriter maintains the order of the attributes.
Without looking at the source, I'd guess that would be the case due to the
stream-character of the class, but I am not sure. It would be worth a
look.

André

*) Though I would not be too suprised if there are corner cases for cases
where the hashes of the attributes collide.

_______________________________________________
Qt-interest mailing list
Qt-interest at qt.nokia.com
http://lists.qt.nokia.com/mailman/listinfo/qt-interest

This e-mail and the information, including any attachments, it contains are intended to be a confidential communication only to the person or entity to whom it is addressed and may contain information that is privileged. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please immediately notify the sender and destroy the original message.

Thank you.

Please consider the environment before printing this email.



More information about the Qt-interest-old mailing list