idrefs and holders [message #602610] |
Wed, 12 September 2007 11:09 |
Eclipse User |
|
|
|
Hi all,
I have two questions regarding binding of IDREF and IDREFS.
1. Is there a way to generally bind IDREF/S to references (to EObject or the like) instead of String attributes? I have a schema here that
makes frequent use of IDREFs without the referenced elements having a common super type, so I don't have any real type to use with
ecore:reference. By accident I found out that XSD will bind IDREFs to EObject if the type specified by ecore:reference doesn't exist in the
schema, so currently I have it working by using ecore:reference="ecore:EObject". But I'm wondering if there's a better way because this
seems a bit like exploiting a "loophole".
2. I have quite a few elements of the following form:
<xs:complexType name="Accessory_occurrence">
<xs:sequence>
<xs:element name="Reference_element" type="xs:IDREFS"
ecore:reference="kbl:Connector_occurrence"/>
...
</xs:sequence>
</xs:complexType>
XSD will generate a holder class ReferenceElementHolder for this. While I can see that this makes sense in case of the element having an
upper bound > 1, I don't think it is necessary here. And it really makes the API ugly because I have quite a lot of those to deal with. So
I'd like to know if there's an easy way to get rid of those holders in this case or if I'd have to write custom XMLSave and XMLHandler classes.
Thanks,
Carsten
|
|
|
Powered by
FUDForum. Page generated in 0.04526 seconds