Open generated XML (from EMF/GMF) again [message #198967] |
Fri, 25 July 2008 08:26  |
Eclipse User |
|
|
|
Originally posted by: b.buchhold.googlemail.com
Hello,
I'm pretty new to GMF but I really enjoy it so far. I'm already to
graphically edit my domain model at will. Apart from that I also generated
XML from a domain model I created with my diagram. The generated file
pretty much includes the same information that is also stored in the XMI
file, but it has to have a different format.
Right now I really need to read the generated XML (in my own syntax) in
again and edit it in my diagram again. I wonder how this is usually done.
First of all I tried to parse the XML and build up my domain model again
using the factory and classes generated by the genmodel. Works great but I
don't know how to persist the domain model as XMI file again or how to
initialize the diagram file from it since I only reconstructed my domain
model while the similar actions of the generated xyz.diagram plug-in all
use the corresponding edit parts. Anyway I'm confident I can solve this by
just reading some more and getting into the whole architecture some more.
I dont really understand all generated diagram code, yet.
On the other hand I don't know if it's a good idea anyway. Actually I
would prefer to work with an XML-File using my own syntax instead of the
XMI files. My XML files already are quite similar and I just need that
format since they're used by an existing application already. Although
personally I'd prefer working with the XMI files and generating the XML
only at build time of the whole application, this is not possible. The XML
files have to be checked in into a svn and have to be available. In order
to prevent duplicates, the XMIs cannot be checked in, instead.
Finally the easiest method might be to generate the XMI files from my XML
without even using the classes of my domain model. But I really dislike
this option.
So what's a good practice to do what I need?
1. Work with XML files only? How could this be done?
2. Also think of my domain model as the thing I work with and
load/generate whatever I need? How could I persist my domain model if all
I have is an EClass instance of my root element with all containments of
course?
3. Do file transformations without regarding my domain model? <- Would be
quite painful to hide generated files from the user of the final plug-in.
I dont like it
Thanks a lot in advance,
Björn
|
|
|
Re: Open generated XML (from EMF/GMF) again [message #199105 is a reply to message #198967] |
Mon, 28 July 2008 06:07  |
Eclipse User |
|
|
|
Hello Bjoern,
You can use .xsd document to initialise your domain model. As a result all
the data from your domain model will be automatically stored by EMF in accordance
with specified xsd (using proprietary XML format). I think this is a way
to follow. :-) For more details see EMF documentation.
-----------------
Alex Shatalin
|
|
|
Powered by
FUDForum. Page generated in 0.03491 seconds