|Re: Don't Get It - anyURI and ecore:reference [message #1002246 is a reply to message #1002145]
||Fri, 18 January 2013 08:39
| Ed Merks
Registered: July 2009
On 18/01/2013 3:54 AM, Brandon Lewis wrote:
> I am using a publicly available IEEE schema for project. I have
> extended this schema by simply importing one of my own schemas into it.
> The resulting genmodel, when I create a new EMF Project, has two main
> packages and ecore models generated. One ecore for each of the major
One for each namespace...
> In my schema, I am trying to make a reference to something in the
> larger enclosing schema (the IEEE one). So I'm trying to use the in
> my own schema:
> <xs:complexType name="controlType">
> <xs:element name="registerFieldRef" type="xs:anyURI"
> ecore:reference="fieldType" minOccurs="0" maxOccurs="unbounded"/>
> fieldType is a ComplexType defined in another schema file (the larger
> public schema that "surrounds" my schema. Like this: <xs:complexType
> I have typed at least 50 different things in the ecore:reference=""
> quotes and I can't get anything generated out of EMF that doesn't
> create a reference to a generic EObject. I want a reference to
> FieldType (the Class that EMF correctly creates for the complexType
You have to use exactly what you's put in the type="...". If what
you're trying doesn't work there (i.e., the schema validates it as
unresolved), it won't work in the ecore:reference either.
> I have searched and found people trying to figure out how to get a
> reference to a generic EObject and not a specific type, but I'm trying
> to do the opposite - I want a specific type reference.
> I don't get it. Does ecore:reference need to refer to a Java class or
> something within the schema?
It needs to use a schema reference that would resolve if it were used as
an actual type in the schema. So you need an import and it needs to be
a QName that would resolve properly, so be sure you have an xmlns
declaration for that imported schema's namespace and be sure to use it
as part of you QName reference.
> The package containing the EMF class I want to reference has not been
> created yet by the Model generator, so I don't understand how I could
> make a reference to that.
It needs to be a schema reference...
Powered by FUDForum
. Page generated in 0.08258 seconds