Feature request: stable XML attribute order

Post Reply
sparkyb
Posts: 11
Joined: Fri Apr 17, 2015 11:53 pm
Real Name: Ben Buchwald

This is a bit of a nitpicky request, but it would really be nice if the XML attributes in .qxw files always saved in a consistent order. I check my QLC files into version control, share editing of them with several people, and have written tools to automatically edit them in certain ways. I would really like to be able to diff my files to see what has changed but because the attributes change their order every time, it isn't possible to see real differences. Most people wouldn't care, but for those of us who do need to diff these files it would be really nice if the attribute order was fixed. I looked at the code and it seems you're using Qt's QtDomDocument-based XML library. That library is documented as not guaranteeing attribute order. However according to this page that library is deprecated now anyway and they suggest replacing it with QXmlStreamReader and QXmlStreamWriter which also have the benefit of preserving attribute order. Any chance that you'd consider making the switch? I realize it is a pretty big task. If not, is it something you'd accept a merge for if I did it myself?
plugz
Posts: 637
Joined: Sun Apr 12, 2015 6:30 pm
Real Name: David

I noticed this too, it's a little annoying :)

I suppose you could propose a PR, I'll be happy to test it

It's going to be a huge change though.

Testing will be more complex than writing the code :/
User avatar
mcallegari
Posts: 4727
Joined: Sun Apr 12, 2015 9:09 am
Location: Italy
Real Name: Massimo Callegari
Contact:

I agree. It's annoying but as David said this change is a huge work.
XML read/write is all over QLC+ (might be in 50 different files)

For other projects I've used the QXmlStream classes so I would already be able to do the conversion.
My problem at the moment is the time available :(
User avatar
mcallegari
Posts: 4727
Joined: Sun Apr 12, 2015 9:09 am
Location: Italy
Real Name: Massimo Callegari
Contact:

Further note. Apprently the XmlStreamReader/Writer classes have been introduced with Qt5.
Problem is that the QLC+ Linux version is still released on Qt4, so switching to Qt5 would mean breaking the compatibility with old distros.
plugz
Posts: 637
Joined: Sun Apr 12, 2015 6:30 pm
Real Name: David

"Since version 4.3, Qt provides two new classes for reading and writing XML: QXmlStreamReader and QXmlStreamWriter."

http://doc.qt.io/qt-5/qxmlstreamreader.html

http://doc.qt.io/qt-4.8/qxmlstreamwriter.html

:)
User avatar
mcallegari
Posts: 4727
Joined: Sun Apr 12, 2015 9:09 am
Location: Italy
Real Name: Massimo Callegari
Contact:

I'll shut up then ! :P
Probably what I meant in my mind was "the QtXml module is deprecated since Qt5, in favour of XmlStreamReader/Writer (which are in QtCore)"
Post Reply