Generate XML instance from XML schema [programmatically] [message #1724865] |
Fri, 26 February 2016 16:00  |
Eclipse User |
|
|
|
Hi,
There is this nice tool in Eclipse where you can right click on an XSD file
and chose to generate an XML from it.
I was wondering if there was a way to do the same thing but from java.
(Background of what I am trying to achieve: I used the EMF tools to generate a genmodel along with its ecore model from a XSD. I used that genmodel to generate model code. I want to generate a XML file by using this generated code but I don't want to build the model instance from scratch with the code. Instead I would use the code to load this XML file)
Anybody has done something similar before or might know how to do this?
Thanks !
A.
|
|
|
Re: Generate XML instance from XML schema [programmatically] [message #1724921 is a reply to message #1724865] |
Sat, 27 February 2016 07:46   |
Eclipse User |
|
|
|
Aurel,
Comments below.
On 26.02.2016 17:00, aurel pestell wrote:
> Hi,
>
> There is this nice tool in Eclipse where you can right click on an XSD
> file
> and chose to generate an XML from it.
> I was wondering if there was a way to do the same thing but from java.
I'm sure it's done in Java if it's a tool in Eclipse...
>
> (Background of what I am trying to achieve: I used the EMF tools to
> generate a genmodel along with its ecore model from a XSD. I used that
> genmodel to generate model code. I want to generate a XML file by
> using this generated code but I don't want to build the model instance
> from scratch with the code. Instead I would use the code to load this
> XML file)
How are you imagining generating the XML? You way you want to use the
generated model code, but you don't want to build the model instance
from scratch with code but rather load the XML, but how are you
imagining generating the XML with the model code other than by creating
an instance of the model and then serializing it?
This looks similar to what you're trying to do:
http://modeling-languages.com/a-pseudo-random-instance-generator-for-emf-models/
>
> Anybody has done something similar before or might know how to do this?
> Thanks !
>
> A.
|
|
|
Re: Generate XML instance from XML schema [programmatically] [message #1724928 is a reply to message #1724921] |
Sat, 27 February 2016 08:42   |
Eclipse User |
|
|
|
Hi Ed,
>How are you imagining generating the XML?
I don't know how the "new XML" Eclipse tool works but the result is great: the generated xml is minimal and
that's what I need to instantiate what could be the base of an instance of my ecore.
I don't think the generator involves my ecore model like in the link but only the xml schema (which it's derived from).
|
|
|
Re: Generate XML instance from XML schema [programmatically] [message #1724929 is a reply to message #1724928] |
Sat, 27 February 2016 10:00  |
Eclipse User |
|
|
|
Aurel,
Yes, they no doubt use the schema to generate instances (just as the
link I gave uses the Ecore model and reflection to generated
instances). In either case, I don't know how the code works so only
Google is going to help provide more details...
On 27.02.2016 09:42, aurel pestell wrote:
> Hi Ed,
>
>> How are you imagining generating the XML?
>
> I don't know how the "new XML" Eclipse tool works but the result is
> great: the generated xml is minimal and
> that's what I need to instantiate what could be the base of an
> instance of my ecore.
> I don't think the generator involves my ecore model like in the link
> but only the xml schema (which it's derived from).
>
|
|
|
Powered by
FUDForum. Page generated in 0.04267 seconds