XML comes to Core

· by Thiago Macieira · 2 min read · original post ↗

·

For a while now we’ve been plagued with a side-effect of the module separation in Qt 4: some of the goodies are “downstream” from the module we’re developing code on. This is the case for XML: it’s been in its own module (QtXml) and we have been left with no good XML parsing class in QtCore and QtGui.

As XML seems to be in use everywhere now, we felt that we needed to fix the issue: the light-weight QXmlStreamReader and QXmlStreamWriter classes that Matthias added to Qt 4.3 have been moved “upstream” from QtXml to QtCore. The DOM- and SAX-style classes will remain in QtXml since they have specific uses, while Patternist will probably get a module of its own.

The changes will be available in tonight’s snapshot.

This opens up the way for more moves, if we feel that some functionality is needed. We had been afraid of doing that before because of binary compatibility issues: that is, how do our supported platforms handle the symbols being moved from one library to another? To find that out, I wrote a tester program along with four libraries (DLLs) and ran it in each of our platforms. The results were encouraging:

  • all platforms allow the symbols to appear in QtCore
  • 3 platforms required the symbols to be in both libraries (QtXml as well as QtCore): Windows, MacOS X and AIX
  • all platforms link new programs without errors (apparently AIX generates warnings)

Interestingly, the platforms that allowed pure symbol moving (as opposed to duplicating) are using ELF as the format for their executables. This shows the power of this format, which is unfortunately also one of its major drawbacks: the symbol import table doesn’t say which library the symbol should come from, so the dynamic linker has to search all loaded libraries. MacOS X uses its own format called Mach-O, AIX uses XCOFF and Windows uses a modified version of COFF called Portable Executable.

PS: we have not tested community-supported platforms. If you have access to one such platform, we’re interested in knowing if this latest change affects you in any way.

QtKDE

More on KDE

More from Thiago Macieira