Contents > 7 SDMetrics Metamodel and XMI Transformation Files > 7.2 XMI Transformation Files > 7.2.3 Tips on Writing XMI Transformations > Optional XMI ID Optional XMI ID

When SDMetrics reads an XMI file, a UML model element is recognized only if its XML element in the XMI source file has an XMI ID, specified by the XML attribute "" or "xmi:id". This should be the normal behavior. However, some XMI exporters do not endow all UML model elements with XMI IDs. For such cases, you can specify that an xmitransformation should be applied even if the XML element has no XMI ID:
<xmitransformation modelelement="taggedvalue" xmipattern="UML:TaggedValue" 
   <trigger name="tag" ...
If attribute "requirexmiid" is set to "false", SDMetrics recognizes XML elements which have no XMI ID, as long as the XML element specifies no XMI IDREF cross reference either (attribute "xmi.idref" or "xmi:idref"). This is necessary because XMI 1.x exporters frequently serialize element cross references in a way that would otherwise trigger the creation of a new, unwanted, and empty UML model element for each such cross reference.

On rare occasions, you may need to extract information from XML elements that have no XMI ID but do have an XMI IDREF. You can achieve this with the optional attribute "allowxmiidref" as follows:

<xmitransformation modelelement="eaextensionelement" xmipattern="element" 
    requirexmiid="false" allowxmiidref="true">
	<trigger name="elementref" type="attrval" attr="xmi:idref" />
	<trigger name="name" ... />
By default, "requirexmiid" is "true" and "allowxmiidref" is "false".