Best strategy to use for <XML -> Custom-EMF model> [message #1690972] |
Wed, 01 April 2015 06:56  |
Eclipse User |
|
|
|
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 <XML -> Custom-EMF model> [message #1690981 is a reply to message #1690972] |
Wed, 01 April 2015 08:11  |
Eclipse User |
|
|
|
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
>
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.06190 seconds