What is the recommended way of joining multiple XSDs in a single ECore model? [message #865447] |
Mon, 30 April 2012 08:03  |
Eclipse User |
|
|
|
I am using a set of XSDs that represent domain models for openEHR electronic health record standard. The schemas are modelled so that various schemas are shared by others.
A convenient feature of JAXB is that you can give a directory to jaxb code generator as input, and it would give you all types in all XSDs under that directory. This is especially useful to build a single Java package that will be used for xml data binding.
I could not find a convenient way of doing the same with XSD to ECore conversion. If I point towards a single XSD from the XSD set I'm using, the result is an ECore model that does not include some of the types in XSDs which are not referenced from the pointed XSD.
I end up with creating ECore models from each XSD in the directory, and then I choose one ECore model and load resource(s) to include other models.
Is this the right way to end up with the full ECore model for the whole of XSDs? Is there any other way that would give me a single ECore model from multiple XSDs? Is there anything that may be a problem in my current approach?
|
|
|
Re: What is the recommended way of joining multiple XSDs in a single ECore model? [message #865555 is a reply to message #865447] |
Mon, 30 April 2012 09:04   |
Eclipse User |
|
|
|
Seref,
Comments below.
On 30/04/2012 2:03 PM, Seref Arikan wrote:
> I am using a set of XSDs that represent domain models for openEHR
> electronic health record standard. The schemas are modelled so that
> various schemas are shared by others. A convenient feature of JAXB is
> that you can give a directory to jaxb code generator as input, and it
> would give you all types in all XSDs under that directory. This is
> especially useful to build a single Java package that will be used for
> xml data binding. I could not find a convenient way of doing the same
> with XSD to ECore conversion. If I point towards a single XSD from the
> XSD set I'm using, the result is an ECore model that does not include
> some of the types in XSDs which are not referenced from the pointed XSD.
You can convert several schemas at once. I.e., the wizard lets you
provide a space separated list of URIs for the schemas...
> I end up with creating ECore models from each XSD in the directory,
> and then I choose one ECore model and load resource(s) to include
> other models. Is this the right way to end up with the full ECore
> model for the whole of XSDs?
You'll always end up with a separate EPackage per XML Schema
targetNamespace. If you have a bunch of schemas all with the same
namespace, you should list them all in the wizard when doing the conversion.
> Is there any other way that would give me a single ECore model from
> multiple XSDs?
If they have different targetNamespaces, you can't combine them, if they
all share a targetNamespace, then you can...
> Is there anything that may be a problem in my current approach?
>
>
|
|
|
|
|
|
Re: What is the recommended way of joining multiple XSDs in a single ECore model? [message #868510 is a reply to message #868337] |
Wed, 02 May 2012 01:50  |
Eclipse User |
|
|
|
Seref,
Yes, an EPackage must be uniquely identifiable via its nsURI.
On 01/05/2012 9:17 PM, Seref Arikan wrote:
> Hi Ed, Actually, I was curious about it, what would happen if I load
> another resource, with some types overlapping (due to underlying XSD
> sources) and create references to second resource from the first one?
> The genmodel gave me an error about root packages having the same
> namespace. So it did not (correctly) let me move forward :)
>
> Thanks for your help, again.
>
> Best regards
> Seref
>
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.04020 seconds