I am currently trying to convert an XML Schema to ECore with the Eclipse Modeling Framework. EMF offers the attributre ecore:reference to indicate that an attribute should be translated into an EReference. However, this only works if the attribute is of type IDREF or anyURI. My problem is that any ID referenced via IDREF has to be unique througout the whole XML document. However, my XML has the following structure:
<A id="a1">
<B id="b1">
<ref idref="b2" />
</B>
<B id="b2">
<ref idref="b1" />
</B>
</A>
<A id="a2">
<B id="b1">
<ref idref="b2" />
</B>
<B id="b2">
<ref idref="b1" />
</B>
</A>
The ids of the B-elelemts are only unique inside the sourrounding A-element. Thus the parser will throw an error if i declare the ids of the B-elements as type ID.
How can I tell EMF that idref is a reference to the attribute id of B-element which belongs to the same A-element?