There is an implementation of this in Daffodil as of 2019-06-19 as of git hash 015891ff982144ab07f092a25ab133707a9a31e9) See the SchemaComponent.scala file. This will be part of the Daffodil 2.4.0 release and subsequent releases.
Short Schema Component Designators (SSCD)
This is loosely based on the concepts of the W3C Schema Component Designator (SCD) spec:
http://www.w3.org/TR/xmlschema-ref/
However, this must be adapted to our needs, as it is a bit too verbose to use in diagnostic messages, and doesn't have a notion of schema document, etc.
...
A path step is constructed as per this table. The single letter "N" denotes a number which is the position of the construct within the enclosing element, but only if that position is greater than 1. If the position is 1 (this is 1-based indexing), then no number is used. This provides uniqueness, but does not provide XPath-style indexing information based on the kind of construct. That is, if an element reference is followed by a sequence then the element reference will get N and the sequence N+1 even though they are not the same kind of construct.
Construct | SSCD Path Step |
---|---|
Element Reference <xs:element ref="QName" ....> | erN=QName |
Local Element Decl <xs:element name="name" ...> | eN=QName if the element form is "qualified" eN=NCName if the element form is "unqualified" |
Global Element Decl <xs:element name="name"...> | e=QName |
Global ComplexType Def <xs:complexType name="name" ....> | ct=QName |
Local Complex Type Def <xs: element ...><xs:complexType>... | ct |
Element's Type Reference to a Global Complex Type | ct=QName |
Global Simple Type Def <xs:simpleType name="name"...> | st=QName |
Local Simple Type Def
|
| st |
(tbd: how to reference parts of unions, clauses within restrictions) |
Element's Type Reference to a Global Simple Type |
or to a primitive type. | st=QName |
Choice Group | cN |
Sequence Group | sN |
Global Choice Group Def <xs:group name="QName"><xs:choice ...>... | cgd=QName |
Global Sequence Group Def <xs:group name="QName"><xs:sequence ...>... | sgd=QName |
Group Reference to a Global Choice Group Def | cgrN=QName |
Group Reference to a Global Sequence Group Def | sgrN=QName |
Implementation Notes
It is not always possible to form an SSCD for a schema component in a non-well formed DFDL schema. For example, suppose a global element decl is missing its name attribute. There is no way to refer to that problematic part of the schema using an SSCD because the QName must be part of the SSCD. For this case, use an XPath treating the DFDL schema file as an XML document.
...