General XML
X1: Include a reference to the profile XSD generated by the Component Registry
For each profile stored in the Component Registry a dynamically generated XSD is available. The URL of this XSD is available in the Info dialog of a profile and should be included in the schemaLocation attribute on the CMD root element. This enables validation of a CMD record by general XSD validators, including the CMDI Validator. The Component Registry URL should be used as it ensures that fixes in the transformation from a profile specification into an XSD are included in the validation process.
X2: Use common namespace prefixes
Namespace prefixes are officially just syntactic sugar in XML, i.e., provide a convenient shortcut. However, using common prefixes enable users to quickly assess the scope of an element. The CMDI 1.2 specification recommends the following prefixes for the namespaces URIs in CMDI:
Prefix | Namespace Name | Comment | Recommended Syntax |
cmd | CMDI instance (general/envelope) | prefixed | |
cmdp | CMDI payload (profile specific) | prefixed | |
cue | Cues for tools | prefixed | |
xs | XML Schema | prefixed | |
xsi | XML Schema instance | prefixed |
See section 3.4 regarding validation, which implies well-formed XML.
X3: Use UTF-8 encoding
The encoding of a CMD record, i.e., XML documents in general, doesn’t have to be stated explicitly. It can be provided in various, possibly conflicting ways: via a Byte Order Marker (BOM), in the XML declaration of the document or a HTTP header. The best practice is to align all these methods to express an UTF-8 encoding, but include at least the XML declaration to indicate the encoding used.
Last updated