|
Re: How to annotate genmodel with a relative import location? [message #69449 is a reply to message #69428] |
Sat, 26 August 2006 17:01   |
Eclipse User |
|
|
|
Originally posted by: merks.ca.ibm.com
Matthew,
The schema location in the generated schema will try to create a
relative path between the absolute path of the schema you are
generating, typically platform:/resource/<project>/model/Xyz.xsd, and
the absolute URI of the schema being referenced, which appears to be
"file:/C:/working/eclipse/cars/parts.xsd". Since that's not possible, an
absolute URI would be used. But, if you export to the same folder, so
that a relative path correctly resolves, then that relative path should
be generated. (I wonder if when you import from a schema, the GenModel
should already be set up as if it exports to that same location?) What
I would typically expect is that each model exports a schema to its
model folder and hence references between model schemas will typically
be of the form ../../<other-project/model/Xyz.xsd.
Matthew Rawlings wrote:
> How can I annotate the genmodel to generate the correct schemaLocation value
> for an import?
>
> I successfully generate an eCore model and genmodel from this schema.
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema xmlns="http://www.acme.com/vehicles"
> xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns:ns1="http://www.acme.com/parts"
> targetNamespace="http://www.acme.com/vehicles"
> elementFormDefault="qualified" attributeFormDefault="unqualified">
> <xs:import namespace="http://www.acme.com/parts"
> schemaLocation="Parts.xsd"/>
> <xs:element name="car">
> <xs:complexType>
> <xs:sequence>
> <xs:element ref="ns1:wheel"/>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> </xs:schema>
>
> From the eCore model I want to export the model to an XSD. When I export I
> get this schema.
> <?xml version="1.0" encoding="UTF-8"?>
> <xsd:schema xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
> xmlns:parts="http://www.acme.com/parts"
> xmlns:vehicles="http://www.acme.com/vehicles"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> ecore:documentRoot="DocumentRoot" ecore:nsPrefix="vehicles"
> ecore:package="com.acme.vehicles"
> targetNamespace="http://www.acme.com/vehicles">
> <xsd:import namespace="http://www.acme.com/parts"
> schemaLocation="file:/C:/working/eclipse/cars/parts.xsd"/>
> <xsd:element name="car" type="vehicles:car_._type"/>
> <xsd:complexType ecore:name="CarType" name="car_._type">
> <xsd:sequence>
> <xsd:element ref="parts:wheel"/>
> </xsd:sequence>
> </xsd:complexType>
> </xsd:schema>
>
> How can I make the value of the schemaLocation in the import be the relative
> location of "parts.xsd"? I do not want "platform" as the scheme for my URIs.
> I want to do this using annotations/detail on the genmodel rather than
> coding around it.
>
> - Matthew
>
>
>
|
|
|
|
Re: How to annotate genmodel with a relative import location? [message #69489 is a reply to message #69469] |
Sun, 27 August 2006 08:42  |
Eclipse User |
|
|
|
Originally posted by: merks.ca.ibm.com
Matthew,
It's not working as well as I expected. Please open a bugzilla.
Matthew Rawlings wrote:
> Hi Ed,
>
> Using the default settings and doing a straight import and export from one
> genmodel to the same folder I do get the relative schemaLocation. An example
> of the result is below.
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xsd:schema xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
> xmlns:parts="http://www.acme.com/parts"
> xmlns:vehicles="http://www.acme.com/vehicles"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> ecore:documentRoot="DocumentRoot" ecore:nsPrefix="vehicles"
> ecore:package="com.acme.vehicles"
> targetNamespace="http://www.acme.com/vehicles">
> <xsd:import namespace="http://www.acme.com/parts"
> schemaLocation="platform:/resource/trans/model/parts.xsd"/ >
> <xsd:element name="car" type="vehicles:car_._type"/>
> <xsd:complexType ecore:name="CarType" name="car_._type">
> <xsd:sequence>
> <xsd:element ref="parts:wheel"/>
> </xsd:sequence>
> </xsd:complexType>
> </xsd:schema>
>
> Q1. My problem is how to get schemaLocation="parts.xsd" instead of
> schemaLocation="platform:/resource/trans/model/parts.xsd"/ >.
>
> The URI scheme of "platform" is not suitable for producing a schema for
> other tools to digest.
>
> Q2. Can I do this using annotations on the genmodel?
>
> Thanks for the quick response. - Matthew
>
>
>
|
|
|
Re: How to annotate genmodel with a relative import location? [message #598633 is a reply to message #69428] |
Sat, 26 August 2006 17:01  |
Eclipse User |
|
|
|
Matthew,
The schema location in the generated schema will try to create a
relative path between the absolute path of the schema you are
generating, typically platform:/resource/<project>/model/Xyz.xsd, and
the absolute URI of the schema being referenced, which appears to be
"file:/C:/working/eclipse/cars/parts.xsd". Since that's not possible, an
absolute URI would be used. But, if you export to the same folder, so
that a relative path correctly resolves, then that relative path should
be generated. (I wonder if when you import from a schema, the GenModel
should already be set up as if it exports to that same location?) What
I would typically expect is that each model exports a schema to its
model folder and hence references between model schemas will typically
be of the form ../../<other-project/model/Xyz.xsd.
Matthew Rawlings wrote:
> How can I annotate the genmodel to generate the correct schemaLocation value
> for an import?
>
> I successfully generate an eCore model and genmodel from this schema.
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema xmlns="http://www.acme.com/vehicles"
> xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns:ns1="http://www.acme.com/parts"
> targetNamespace="http://www.acme.com/vehicles"
> elementFormDefault="qualified" attributeFormDefault="unqualified">
> <xs:import namespace="http://www.acme.com/parts"
> schemaLocation="Parts.xsd"/>
> <xs:element name="car">
> <xs:complexType>
> <xs:sequence>
> <xs:element ref="ns1:wheel"/>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> </xs:schema>
>
> From the eCore model I want to export the model to an XSD. When I export I
> get this schema.
> <?xml version="1.0" encoding="UTF-8"?>
> <xsd:schema xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
> xmlns:parts="http://www.acme.com/parts"
> xmlns:vehicles="http://www.acme.com/vehicles"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> ecore:documentRoot="DocumentRoot" ecore:nsPrefix="vehicles"
> ecore:package="com.acme.vehicles"
> targetNamespace="http://www.acme.com/vehicles">
> <xsd:import namespace="http://www.acme.com/parts"
> schemaLocation="file:/C:/working/eclipse/cars/parts.xsd"/>
> <xsd:element name="car" type="vehicles:car_._type"/>
> <xsd:complexType ecore:name="CarType" name="car_._type">
> <xsd:sequence>
> <xsd:element ref="parts:wheel"/>
> </xsd:sequence>
> </xsd:complexType>
> </xsd:schema>
>
> How can I make the value of the schemaLocation in the import be the relative
> location of "parts.xsd"? I do not want "platform" as the scheme for my URIs.
> I want to do this using annotations/detail on the genmodel rather than
> coding around it.
>
> - Matthew
>
>
>
|
|
|
Re: How to annotate genmodel with a relative import location? [message #598639 is a reply to message #69449] |
Sun, 27 August 2006 07:25  |
Eclipse User |
|
|
|
Hi Ed,
Using the default settings and doing a straight import and export from one
genmodel to the same folder I do get the relative schemaLocation. An example
of the result is below.
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
xmlns:parts="http://www.acme.com/parts"
xmlns:vehicles="http://www.acme.com/vehicles"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
ecore:documentRoot="DocumentRoot" ecore:nsPrefix="vehicles"
ecore:package="com.acme.vehicles"
targetNamespace="http://www.acme.com/vehicles">
<xsd:import namespace="http://www.acme.com/parts"
schemaLocation="platform:/resource/trans/model/parts.xsd"/ >
<xsd:element name="car" type="vehicles:car_._type"/>
<xsd:complexType ecore:name="CarType" name="car_._type">
<xsd:sequence>
<xsd:element ref="parts:wheel"/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
Q1. My problem is how to get schemaLocation="parts.xsd" instead of
schemaLocation="platform:/resource/trans/model/parts.xsd"/ >.
The URI scheme of "platform" is not suitable for producing a schema for
other tools to digest.
Q2. Can I do this using annotations on the genmodel?
Thanks for the quick response. - Matthew
|
|
|
Re: How to annotate genmodel with a relative import location? [message #598647 is a reply to message #69469] |
Sun, 27 August 2006 08:42  |
Eclipse User |
|
|
|
Matthew,
It's not working as well as I expected. Please open a bugzilla.
Matthew Rawlings wrote:
> Hi Ed,
>
> Using the default settings and doing a straight import and export from one
> genmodel to the same folder I do get the relative schemaLocation. An example
> of the result is below.
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xsd:schema xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
> xmlns:parts="http://www.acme.com/parts"
> xmlns:vehicles="http://www.acme.com/vehicles"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> ecore:documentRoot="DocumentRoot" ecore:nsPrefix="vehicles"
> ecore:package="com.acme.vehicles"
> targetNamespace="http://www.acme.com/vehicles">
> <xsd:import namespace="http://www.acme.com/parts"
> schemaLocation="platform:/resource/trans/model/parts.xsd"/ >
> <xsd:element name="car" type="vehicles:car_._type"/>
> <xsd:complexType ecore:name="CarType" name="car_._type">
> <xsd:sequence>
> <xsd:element ref="parts:wheel"/>
> </xsd:sequence>
> </xsd:complexType>
> </xsd:schema>
>
> Q1. My problem is how to get schemaLocation="parts.xsd" instead of
> schemaLocation="platform:/resource/trans/model/parts.xsd"/ >.
>
> The URI scheme of "platform" is not suitable for producing a schema for
> other tools to digest.
>
> Q2. Can I do this using annotations on the genmodel?
>
> Thanks for the quick response. - Matthew
>
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.04619 seconds