Use non-deprecated <gui> root element
ClosedPublic

Authored by kossebau on Apr 4 2017, 1:06 AM.

Details

Summary

The DTD talks about <kpartgui> being deprecated as toplevel element,
so the data and tests should follow that.

Also fixes wrong DOCTYPE name usage, "gui" instead of "kpartgui"
makes no sense given there is only the one DTD
(will be separate commit).
To reduce confusion there either should be a new DTD
or the already existing kxmlgui.xsd schema and the respective
header should be promoted.

Test Plan

Tests still work, tested apps also.

Diff Detail

Repository
R263 KXmlGui
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
kossebau created this revision.Apr 4 2017, 1:06 AM
Restricted Application added a project: Frameworks. · View Herald TranscriptApr 4 2017, 1:06 AM
aacid added a subscriber: aacid.Apr 4 2017, 10:07 PM

Do you know where we do the parsing that allows both gui and kpartgui to be "valid"?

I did some searching and i think i found it but would be nice if you can find it and we agree on it D:

In D5296#99818, @aacid wrote:

Do you know where we do the parsing that allows both gui and kpartgui to be "valid"?

I did some searching and i think i found it but would be nice if you can find it and we agree on it D:

What I found is that the parsing does not check the name of the root element, so <gui>, <kpartgui> or the more ancient <kpartplugin> (which I came across e.g. in some rc files KDevPlatform) all work. Or whatever else one might use, like <mylittlegui> ;)

For code which does that, I think e.g. of KXMLGUIClient::setDOMDocument(), which just takes the doc.documentElement() of the passed DOM documents without any validation.

Ping? If no-one has further comments or objects, will push around April 17th.

aacid accepted this revision.Apr 10 2017, 7:29 PM
This revision is now accepted and ready to land.Apr 10 2017, 7:29 PM
This revision was automatically updated to reflect the committed changes.

Eek, I just learned that changing the doctype name to "kpartgui" breaks the XML standard, which requires this:
"The Name in the document type declaration MUST match the element type of the root element." (cmp. https://www.w3.org/TR/xml11/#dt-doctype)

That info was missing/wrong in the comments in kpartgui.dtd which talk about the deprecated/non-deprecated root element.

Needs a fixup patch, will do tomorrow.