Skip to main content



      Home
Home » Modeling » EMF » EMF to XML Persistence
EMF to XML Persistence [message #403755] Fri, 22 September 2006 03:54 Go to next message
Eclipse UserFriend
Hi ,

I have a small issue while persisting EMF (XMI) as XML .I have an EMF
model I want that model to be persisted as XML

E.g I have Struts EMF model and it needs to be persisted as
Struts-config.xml

I have a set of Mappings EMF Feature to XML element , but i get errors
while loading the model

Say for e.g my Root Feature StrutsConfigType of EMF is mapped to a XML
element <struts-config> , its saving properly but when i try to load the
same in the editor its searching for the struts-config as feature rather
than my actual StrutsConfigType EClass .

Any pointers and help in this Regard will be highly apperiaciated.Also
some examples on using EXTENDED_META_DATA option and its sub classes

Thanks,
Kamesh
Re: EMF to XML Persistence [message #403761 is a reply to message #403755] Fri, 22 September 2006 07:58 Go to previous messageGo to next message
Eclipse UserFriend
Kamesh,

Does your model have a DocumentRoot EClass? Is it based on a schema
originally, i.e., did you import the model from a .xsd? If there is a
document root present, the root element of the instance must match one
of the element-based features in the document root; only if there is no
document root will the element name be used to look up an EClass. The
files org.eclipse.emf.ecore.xmi.impl.EMOF*.java show we use this to
serialize .ecore as .emof.


Kamesh Sampath wrote:
> Hi ,
>
> I have a small issue while persisting EMF (XMI) as XML .I have an EMF
> model I want that model to be persisted as XML
> E.g I have Struts EMF model and it needs to be persisted as
> Struts-config.xml
>
> I have a set of Mappings EMF Feature to XML element , but i get errors
> while loading the model
> Say for e.g my Root Feature StrutsConfigType of EMF is mapped to a XML
> element <struts-config> , its saving properly but when i try to load
> the same in the editor its searching for the struts-config as feature
> rather than my actual StrutsConfigType EClass .
> Any pointers and help in this Regard will be highly apperiaciated.Also
> some examples on using EXTENDED_META_DATA option and its sub classes
>
> Thanks,
> Kamesh
>
>
Re: EMF to XML Persistence [message #403765 is a reply to message #403761] Fri, 22 September 2006 09:36 Go to previous messageGo to next message
Eclipse UserFriend
Ed Merks wrote:
> Kamesh,
>
> Does your model have a DocumentRoot EClass? Is it based on a schema
> originally, i.e., did you import the model from a .xsd? If there is a
> document root present, the root element of the instance must match one
> of the element-based features in the document root; only if there is no
> document root will the element name be used to look up an EClass. The
> files org.eclipse.emf.ecore.xmi.impl.EMOF*.java show we use this to
> serialize .ecore as .emof.
>
>
> Kamesh Sampath wrote:
>> Hi ,
>>
>> I have a small issue while persisting EMF (XMI) as XML .I have an EMF
>> model I want that model to be persisted as XML
>> E.g I have Struts EMF model and it needs to be persisted as
>> Struts-config.xml
>>
>> I have a set of Mappings EMF Feature to XML element , but i get errors
>> while loading the model
>> Say for e.g my Root Feature StrutsConfigType of EMF is mapped to a XML
>> element <struts-config> , its saving properly but when i try to load
>> the same in the editor its searching for the struts-config as feature
>> rather than my actual StrutsConfigType EClass .
>> Any pointers and help in this Regard will be highly apperiaciated.Also
>> some examples on using EXTENDED_META_DATA option and its sub classes
>>
>> Thanks,
>> Kamesh
>>
>>
Ed:
I dont have the document root I just used the DTD and generate the
*.ecore file from scratch matching the DTD . When i save the model its
saving it properly but when i load the same in the Editor it sucks !
I followed the IBM Redbook on EMF and GEF to do the Custom serilization.
Please let me know what are all the things i need to take care when
saving and loding the document.

I want to simulate somthing like the plugin.xml editor for Struts
configuation file editing .

Thanks
Kamesh
Re: EMF to XML Persistence [message #403766 is a reply to message #403765] Fri, 22 September 2006 10:47 Go to previous messageGo to next message
Eclipse UserFriend
Kamesh,

One of the things you can do is Generate Test Code and that will produce
an XyzExample.java in the *.tests project. With that you should be able
to reproduce any problems in a minimal environment. If you could zip up
your model project and your *.tests project for that model, modified to
reproduce the problem you are seeing, then I can much more easily answer
your question via such a concrete example. You can send it to my e-mail
directly if you don't wish to make it public in the newsgroup as an
attachment. My e-mail is merks at ca dot ibm dot com.


Kamesh Sampath wrote:
> Ed Merks wrote:
>> Kamesh,
>>
>> Does your model have a DocumentRoot EClass? Is it based on a schema
>> originally, i.e., did you import the model from a .xsd? If there is
>> a document root present, the root element of the instance must match
>> one of the element-based features in the document root; only if there
>> is no document root will the element name be used to look up an
>> EClass. The files org.eclipse.emf.ecore.xmi.impl.EMOF*.java show we
>> use this to serialize .ecore as .emof.
>>
>>
>> Kamesh Sampath wrote:
>>> Hi ,
>>>
>>> I have a small issue while persisting EMF (XMI) as XML .I have an
>>> EMF model I want that model to be persisted as XML
>>> E.g I have Struts EMF model and it needs to be persisted as
>>> Struts-config.xml
>>>
>>> I have a set of Mappings EMF Feature to XML element , but i get
>>> errors while loading the model
>>> Say for e.g my Root Feature StrutsConfigType of EMF is mapped to a
>>> XML element <struts-config> , its saving properly but when i try to
>>> load the same in the editor its searching for the struts-config as
>>> feature rather than my actual StrutsConfigType EClass .
>>> Any pointers and help in this Regard will be highly
>>> apperiaciated.Also some examples on using EXTENDED_META_DATA option
>>> and its sub classes
>>>
>>> Thanks,
>>> Kamesh
>>>
>>>
> Ed:
> I dont have the document root I just used the DTD and generate the
> *.ecore file from scratch matching the DTD . When i save the model its
> saving it properly but when i load the same in the Editor it sucks !
> I followed the IBM Redbook on EMF and GEF to do the Custom serilization.
> Please let me know what are all the things i need to take care when
> saving and loding the document.
>
> I want to simulate somthing like the plugin.xml editor for Struts
> configuation file editing .
>
> Thanks
> Kamesh
Re: EMF to XML Persistence [message #403767 is a reply to message #403766] Fri, 22 September 2006 10:55 Go to previous message
Eclipse UserFriend
Ed Merks wrote:
> Kamesh,
>
> One of the things you can do is Generate Test Code and that will produce
> an XyzExample.java in the *.tests project. With that you should be able
> to reproduce any problems in a minimal environment. If you could zip up
> your model project and your *.tests project for that model, modified to
> reproduce the problem you are seeing, then I can much more easily answer
> your question via such a concrete example. You can send it to my e-mail
> directly if you don't wish to make it public in the newsgroup as an
> attachment. My e-mail is merks at ca dot ibm dot com.
>
>
> Kamesh Sampath wrote:
>> Ed Merks wrote:
>>> Kamesh,
>>>
>>> Does your model have a DocumentRoot EClass? Is it based on a schema
>>> originally, i.e., did you import the model from a .xsd? If there is
>>> a document root present, the root element of the instance must match
>>> one of the element-based features in the document root; only if there
>>> is no document root will the element name be used to look up an
>>> EClass. The files org.eclipse.emf.ecore.xmi.impl.EMOF*.java show we
>>> use this to serialize .ecore as .emof.
>>>
>>>
>>> Kamesh Sampath wrote:
>>>> Hi ,
>>>>
>>>> I have a small issue while persisting EMF (XMI) as XML .I have an
>>>> EMF model I want that model to be persisted as XML
>>>> E.g I have Struts EMF model and it needs to be persisted as
>>>> Struts-config.xml
>>>>
>>>> I have a set of Mappings EMF Feature to XML element , but i get
>>>> errors while loading the model
>>>> Say for e.g my Root Feature StrutsConfigType of EMF is mapped to a
>>>> XML element <struts-config> , its saving properly but when i try to
>>>> load the same in the editor its searching for the struts-config as
>>>> feature rather than my actual StrutsConfigType EClass .
>>>> Any pointers and help in this Regard will be highly
>>>> apperiaciated.Also some examples on using EXTENDED_META_DATA option
>>>> and its sub classes
>>>>
>>>> Thanks,
>>>> Kamesh
>>>>
>>>>
>> Ed:
>> I dont have the document root I just used the DTD and generate the
>> *.ecore file from scratch matching the DTD . When i save the model its
>> saving it properly but when i load the same in the Editor it sucks !
>> I followed the IBM Redbook on EMF and GEF to do the Custom serilization.
>> Please let me know what are all the things i need to take care when
>> saving and loding the document.
>>
>> I want to simulate somthing like the plugin.xml editor for Struts
>> configuation file editing .
>>
>> Thanks
>> Kamesh
Ed:
Thanks for the input . Will try to do the way you told ,if am not
successfull will send it across to your email.

Regards,
Kamesh
Previous Topic:How to create a Custom EMF Editor
Next Topic:EMF "Plug-in Dependencies" Question
Goto Forum:
  


Current Time: Wed May 14 10:08:23 EDT 2025

Powered by FUDForum. Page generated in 0.04089 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top