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: 307
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: 307
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: 33141
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
>
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:[CDO] Comparing Historical revisions: No Permission
Next Topic:Usage of IListener/Adapter
Goto Forum:
  


Current Time: Thu Apr 25 17:26:50 GMT 2024

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

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

Back to the top