Table of Contents
In order to ensure that URI schemes and XML namespaces within the KDE project are consistent and avoids collisions, this document exists to settle best practices, and document the currently used namespaces and URI schemes.
Some applications needs custom URIs schemes in their implementation. Regardless of if the URI scheme is used internally or publically, it is always an unfortunate design choice to simply make up a scheme name(such as my-scheme://my-data) for the simple reason that anyone can do that, and thus potentially cause interoperability issues and confusion. The approach for creating a custom URI scheme without also getting into trouble is to either ensure the scheme is generic to the extent it can be specified in an RFC(similar to urn or http), or to use an existing scheme which was designed for this purpose: the tag scheme.
The tag scheme combines a host name with a date to create a unique URI scheme(the date makes the URI immune to change in ownership of the domain name). KDE applications can use the tag scheme with the kde.org domain by following a slightly constrained syntax of the tag scheme: tag:kde.org,2004:[application name]:[application specific string].[1] For example: tag:kde.org,2004:KMyApplication:MyKApplicationString. The application name ensures that a URI does not clash with a KDE application.
Before using the tag scheme with the KDE domain, the usage should first be suggested on the kde-core-devel@kde.org mailinglist. If agreed to be a sensible URI scheme, the table below should be updated to list the application name.
Table 1. Applications Using the tag Scheme
Application Name | Contact |
---|---|
KMyMoney | kmymoney2-developer@lists.sourceforge.net |
Thus, as example, any URI starting with tag:kde.org,2004:KMyMoney is reserved for KMyMoney's usages.
A URI's design typically stays for a long time -- it can be thought as to be a type of API. Tim Berners-Lee's Cool URIs don't change can perhaps be an inspiration for designing a URI scheme which not only suits the application right now but also years into the future.
One only wants to invent a URI scheme when it is strictly necessary. A reason to that one thinks a new URI scheme needs to be invented, could be that one is unaware of the many existing URI schemes. The article “New URI Schemes: 99% Harmful”, might be a fruitful read as well.
In some circumstances is it necessary for KDE applications to make use of custom XML namespaces. For consistency and proper behavior among XML parsers, these conventions should be followed:
Be valid URIs, as per RFC 3986.
Start with http://www.kde.org/standards/, followed by a name which distinguishes the namespace. After that the resulting string may be extended in anyway(while staying within the constraints of the URI syntax). For example, the namespace http://www.kde.org/standards/kcfg/2.0 as well as http://www.kde.org/standards/KTechnology/ are valid.
Table 2. Current XML Namespaces
URI | Description | Schema | Contact |
---|---|---|---|
http://www.kde.org/standards/kcfg/1.0 | KConfigXT's *.kcfg files. | http://www.kde.org/standards/kcfg/1.0/kcfg.xsd | Frans Englich, frans.englich@telia.com |
Addition of a new namespace should be suggested on kde-core-devel@kde.org mailinglist. If the namespace is decided to be included, this document should be updated to list the new namespace.
Ensure that the XML format the namespace represents is well defined. As with an API, an XML format is an interface which different parties communicates through. Specify the format in W3C XML Schema or RELAX NG(preferrably not DTD since it is less exact), such that it is consciously designed, and not from how an application at the moment happens to read/write files in the format.
[1] Formally speaking, the ABNF product specific(in RFC 4151) is augmented into applicationName ":" applicationSpecific, where both applicationName and applicationSpecific is *( pchar / "/" / "?" ).