This page is a subpage of CMDI 1.2
Generic attributes to CMDI namespace
The issue
All attributes in CMDI 1.1 instances are in no-namespace, this counts for both attributes defined in the component/profile specification and the CMDI common attributes (@ref and @componentId) which have special semantics. Currently, the Component Registry and schematron rules check for the presence of attributes with these names and rejects them. A better solution would be to allow any name for custom attributes and move the reserved attributes into a dedicated namespace.
Proposed solution
Leave custom attributes without namespace and put the following attributes in the same namespace as the elements, namely http://www.clarin.eu/cmd/ (an obvious namespace prefix would be cmd):
- ref
- componentId
Implementation examples
CMDI instance:
<CMD CMDVersion="1.2" xsi:schemaLocation="http://www.clarin.eu/cmd/ http://www.clarin.eu/cmd/example/example-md-schema.xsd" xmlns="http://www.clarin.eu/cmd/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:cmd="http://www.clarin.eu/cmd/"> ... <MyComponent myAttribute="value" cmd:ref="resourceProxy1" cmd:componentId="clarin.eu:cr1:c_1328259700912">...</MyComponent>
To achieve this we have to make the following changes to the XSD generated by comp2schema.xsl:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:dcr="http://www.isocat.org/ns/dcr" xmlns:cmd="http://www.clarin.eu/cmd/" targetNamespace="http://www.clarin.eu/cmd/" elementFormDefault="qualified"> ... <!-- globally declare @ref and @ComponentId, so they have to be qualified --> <xs:attribute name="ref" type="xs:IDREFS"/> <xs:attribute name="ComponentId" type="xs:anyURI"/> ... <xs:element name="myComponent" ... > <xs:complexType> <xs:sequence> ... </xs:sequence> <!-- refer to the globally declared attributes --> <xs:attribute ref="cmd:ref"/> <xs:attribute ref="cmd:ComponentId" fixed="clarin.eu:cr1:c_1328259700912"/> </xs:complexType> </xs:element> ... </xs:schema>
Note: cleanup-xsd.xsl also needs to be adopted as it currently will prune away the new global <xs:attribute/> elements.
Tickets
Tickets in the CMDI 1.2 milestone with the keyword attributenamespace:
Ticket | Summary | Owner | Component | Priority | Status |
---|---|---|---|---|---|
#236 | Namespace prefixes for generic CMDI attributes (and possibly elements) | ComponentSchema | major | closed |
Discussion
Discuss the topic in general below this point