forcing emf to save object ref as @ [message #255715] |
Wed, 07 May 2008 17:38  |
Eclipse User |
|
|
|
Originally posted by: devquestions.gmail.com
Hello Frens,
while analyzing the xmi objects saved using XMIResourceImpl , i see that ,
the local object references are referred using the class type and their
relative order in the xml.
Example
sqlobjects="//@MyClassType1.0/@SQLObjects.15" etc
However, the objects below SQLObjects are referred using names
Eg:
level="//@Inputlayers.0/@SQLObjects.15/Month Level".
Is there a way to force XMIResourceImpl to always save using class type
and relative order in the xml document ?
|
|
|
|
|
|
Re: forcing emf to save object ref as @ [message #255745 is a reply to message #255742] |
Wed, 07 May 2008 21:23  |
Eclipse User |
|
|
|
Originally posted by: merks.ca.ibm.com
Comments below.
dev wrote:
>
> Hi Nick,
>
> Thanks for the note. But I am sorry I do not understand what you are
> saying.
> the fragment segment ("//@SQLObjects.15/Month Level") was generated
> from XMLResourceImpl.
That's not the form it would generate by default. Each segment would be
of the form @<featureName>[.<index>].
> I did not make any changes to it, so I expect that XMLResourceImpl
> should load the objects it saved, however the xml objects do not get
> loaded , on load I get
> org.eclipse.emf.ecore.resource.Resource$IOWrappedException: Unresolved
> reference '//@SQLObjects.15/Month'. exception.
It certainly looks as if someone made changes to id
> I do not see this error when i name object Month_Level instead of
> "Month Level"
Which model is this? If this is a model someone else implemented,
they'll need to fix how they specialized the code to produce this form.
>
> Notice that in the exception the uri fragment is truncated after space.
Yes, I see that.
> On tracing the code I found out that the method
> setValueFromId(EObject object, EReference eReference, String ids) in
> the class org.eclipse.emf.ecore.xmi.impl.XMLHandler
> does this truncation.
It does indeed, as it will always do when it sees a space.
>
> In this scenario I am not sure what I am doing wrong.
The code that produces a fragment based on some value of the model that
allows spaces is not doing such a good job.
> "Month Level" is just an emf object attribute name, it is not even a
> class name.
EMF includes the @ character in front of all the feature names, and
feature names aren't allowed to have spaces, so I'm a little confused.
> Are you saying that emf object attributes cannot use space in them ?
Definitely the name of an EAttribute may not contain a space. Ecore
model instances are validated and report that as an error. Somehow I
get the impression this is the value of data in your instance and that
you're using a model that's specialized the code inappropriately. Which
model is involved?
>
> Thanks !
>
|
|
|
Powered by
FUDForum. Page generated in 0.09099 seconds