Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Best strategy to use for <XML -> Custom-EMF model>
Best strategy to use for <XML -> Custom-EMF model> [message #1690972] Wed, 01 April 2015 10:56 Go to next message
Stefan Winkler is currently offline Stefan WinklerFriend
Messages: 301
Registered: July 2009
Location: Germany
Senior Member
Hi,

I am currently facing the following question:

I have an XSD which defines my XML data structure.
And I have an (existing) Ecore model which defines my custom (target)
EMF data structure.

I now need to read and write XML-files based on the XSD which shall be
represented in the custom EMF model.

I have done searches and found out that there is no out-of-the-box way
to map XSD to a custom Ecore model (correct my if I'm mistaken).
Graphically, there is no way to do this


XML (XSD) <-------[ EMF magic ]------> EMF (Ecore)


So my question now is: does anyone have experience with similar
settings? How did/would you solve this?

Intuitively, I can imagine parsing the XML myself, thus doing this:


XML (XSD) <-------[ custom SAX-based logic ]------> EMF (Ecore)


Or I could generate an intermediate Ecore model for the XSD which does
the XML reading/writing for me, but then I have to create mapping logic
to my EMF model like this:


XML (XSD) <-[ EMF serialization ]-> XSD_EMF (Ecore) <-- ...
... --[ EMF serialization ]-> EMF (Ecore)


Does anyone have an opinion which approach seems better (both in terms
of runtime performance, and in development effort).

Thanks in advance,
Stefan
Re: Best strategy to use for &lt;XML -&gt; Custom-EMF model&gt; [message #1690973 is a reply to message #1690972] Wed, 01 April 2015 11:02 Go to previous messageGo to next message
Stefan Winkler is currently offline Stefan WinklerFriend
Messages: 301
Registered: July 2009
Location: Germany
Senior Member
sorry, the last diagram should be

XML (XSD) <-[ EMF serialization ]-> XSD_EMF (Ecore) <-- ...
... --[ custom mapping logic ]-> EMF (Ecore)


Am 01.04.15 um 12:56 schrieb Stefan Winkler:
> Hi,
>
> I am currently facing the following question:
>
> I have an XSD which defines my XML data structure.
> And I have an (existing) Ecore model which defines my custom (target)
> EMF data structure.
>
> I now need to read and write XML-files based on the XSD which shall be
> represented in the custom EMF model.
>
> I have done searches and found out that there is no out-of-the-box way
> to map XSD to a custom Ecore model (correct my if I'm mistaken).
> Graphically, there is no way to do this
>
>
> XML (XSD) <-------[ EMF magic ]------> EMF (Ecore)
>
>
> So my question now is: does anyone have experience with similar
> settings? How did/would you solve this?
>
> Intuitively, I can imagine parsing the XML myself, thus doing this:
>
>
> XML (XSD) <-------[ custom SAX-based logic ]------> EMF (Ecore)
>
>
> Or I could generate an intermediate Ecore model for the XSD which does
> the XML reading/writing for me, but then I have to create mapping logic
> to my EMF model like this:
>
>
> XML (XSD) <-[ EMF serialization ]-> XSD_EMF (Ecore) <-- ...
> ... --[ EMF serialization ]-> EMF (Ecore)
>
>
> Does anyone have an opinion which approach seems better (both in terms
> of runtime performance, and in development effort).
>
> Thanks in advance,
> Stefan
>
>
>
Re: Best strategy to use for &lt;XML -&gt; Custom-EMF model&gt; [message #1690981 is a reply to message #1690972] Wed, 01 April 2015 12:11 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 30540
Registered: July 2009
Senior Member
Stefan,

It's not clear how different those two representations are, so it's hard
to comment... To me generally it seems easier to have two well-defined
Java APIs and write Java code to map instances between those
representations than to write Java code for serializer and deserializer
logic. I doubt performance will be a significant concern either way.


On 01/04/2015 12:56 PM, Stefan Winkler wrote:
> Hi,
>
> I am currently facing the following question:
>
> I have an XSD which defines my XML data structure.
> And I have an (existing) Ecore model which defines my custom (target)
> EMF data structure.
>
> I now need to read and write XML-files based on the XSD which shall be
> represented in the custom EMF model.
>
> I have done searches and found out that there is no out-of-the-box way
> to map XSD to a custom Ecore model (correct my if I'm mistaken).
> Graphically, there is no way to do this
>
>
> XML (XSD) <-------[ EMF magic ]------> EMF (Ecore)
>
>
> So my question now is: does anyone have experience with similar
> settings? How did/would you solve this?
>
> Intuitively, I can imagine parsing the XML myself, thus doing this:
>
>
> XML (XSD) <-------[ custom SAX-based logic ]------> EMF (Ecore)
>
>
> Or I could generate an intermediate Ecore model for the XSD which does
> the XML reading/writing for me, but then I have to create mapping logic
> to my EMF model like this:
>
>
> XML (XSD) <-[ EMF serialization ]-> XSD_EMF (Ecore) <-- ...
> ... --[ EMF serialization ]-> EMF (Ecore)
>
>
> Does anyone have an opinion which approach seems better (both in terms
> of runtime performance, and in development effort).
>
> Thanks in advance,
> Stefan
>
>
>
Previous Topic:[CDO] Comparing Historical revisions: No Permission
Next Topic:Usage of IListener/Adapter
Goto Forum:
  


Current Time: Mon Oct 14 05:42:59 GMT 2019

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

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

Back to the top