Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Emf->Xsd->Java code to serialize deserialize xml
Emf->Xsd->Java code to serialize deserialize xml [message #558980] Wed, 15 September 2010 08:40 Go to next message
moritz du is currently offline moritz duFriend
Messages: 102
Registered: February 2010
Senior Member
the only thing i want to do is to read and write xml-files specified by a xsd-file. i tried jaxb but it ignores all restrictions in object space (no validation).
so i stumbled across emf. it seems to do - among other things Wink - exactly what i need.
in meanwhile i generated code from the xsd i need. but what now? At the end i want a minimum set of classes and dependencies to read and write xml files respecting the underlying xsd - and use them in a maven project. how to do this?

splitting it up in subquestions:

- how to use the generated code to read/write xml files?
- how to cut or generate an artifact out of the emf-eclipse-project to be used as "myxmlapi"(.jar with needed dependencies)

thx in advance
Re: Emf->Xsd->Java code to serialize deserialize xml [message #559214 is a reply to message #558980] Thu, 16 September 2010 02:36 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 30553
Registered: July 2009
Senior Member
Comments below.

tanteanni@hotmail.com wrote:
> the only thing i want to do is to read and write xml-files specified
> by a xsd-file. i tried jaxb but it ignores all restrictions in object
> space (no validation).
I'm not surprised. Restrictions are just not well expressed/represented
in Java or any other object oriented language (which focus on extension).
> so i stumbled across emf. it seems to do - among other things ;) -
> exactly what i need.
> in meanwhile i generated code from the xsd i need. but what now? At
> the end i want a minimum set of classes and dependencies to read and
> write xml files respecting the underlying xsd - and use them in a
> maven project. how to do this?
If you invoke Generate Test Code you'll end up with a small example that
reads and writes instances.
>
> splitting it up in subquestions:
>
> - how to use the generated code to read/write xml files?
> - how to cut or generate an artifact out of the emf-eclipse-project
> to be used as "myxmlapi"(.jar with needed dependencies)
If you run the generated XyzExample.java you'll get the idea. The XML
binding article on the documentation page is quite useful too.
>
> thx in advance
Re: Emf->Xsd->Java code to serialize deserialize xml [message #559245 is a reply to message #559214] Thu, 16 September 2010 07:33 Go to previous message
moritz du is currently offline moritz duFriend
Messages: 102
Registered: February 2010
Senior Member
thx for the "generate test code" hint - very helpful

i'll examine it...
Previous Topic:Re: [cdo] streaming large data?
Next Topic:containment and emf treenode model
Goto Forum:
  


Current Time: Mon Oct 21 22:36:29 GMT 2019

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

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

Back to the top