XSD -> ECORE conversion : problem with XSD inclusion [message #66406] |
Thu, 04 January 2007 10:49 ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: turmeau.laurent.fmtls.siemensvdo.com
Hello,
I'm creating an EMF project, and the ECORE model is imported from a XML
schema.
This XML schema includes another one like this:
test.xsd
<xs:schema xmlnss="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:include schemaLocation="template_declaration.xsd"/>
<xs:element name="TOTO">
<xs:complexType>
<xs:sequence>
<xs:element ref="TITI_1" minOccurs="0"/>
<xs:element ref="TITI_2" minOccurs="0"/>
</xs:sequence>
<xs:attribute name="Name" use="required">
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:schema>
The ECORE model is generated successfully, but the Root package is
templateDeclaration whereas TOTO is expected.
I tried to avoid this, using ecore directives in the XSD to force the
generated package name. it gives something like this:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified" attributeFormDefault="unqualified"
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
ecore:package="TOTO"
ecore:nsPrefix="TOTO">
<xs:include schemaLocation="template_declaration.xsd"/>
...
Now, a TOTOPackage interface is generated, that defines:
String eNAME = "TOTO";
String eNS_URI =
" file:/C:/DATA/WICO_TLS/CongaConfig/xsd/template_declaration. xsd ";
String eNS_PREFIX = "TOTO";
The URI is not correct: test.xsd is expected. Indeed, when I try to load a
XML resource, EMF tries to map the XML against the
template_declaration.xsd. And it fails.
Has anybody encountered this problem?
regards
Laurent
|
|
|
Re: XSD -> ECORE conversion : problem with XSD inclusion [message #68159 is a reply to message #66406] |
Tue, 16 January 2007 12:29 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: merks.ca.ibm.com
Laurent,
I think you asked this same question on the EMF newsgroup... The
XSDEcoreBuilder processes all the elements and types of a schema in
arbitrary order and hence the first element or type processed for the
null namespace will determine which physical schema location is used as
the nsURI. It's probably best to define your schemas to have a
targetNamespace...
Laurent TURMEAU wrote:
> Hello,
>
> I'm creating an EMF project, and the ECORE model is imported from a
> XML schema.
> This XML schema includes another one like this:
>
> test.xsd
>
> <xs:schema xmlnss="http://www.w3.org/2001/XMLSchema"
> elementFormDefault="qualified" attributeFormDefault="unqualified">
> <xs:include schemaLocation="template_declaration.xsd"/>
> <xs:element name="TOTO">
> <xs:complexType>
> <xs:sequence>
> <xs:element ref="TITI_1" minOccurs="0"/>
> <xs:element ref="TITI_2" minOccurs="0"/>
> </xs:sequence>
> <xs:attribute name="Name" use="required">
> </xs:attribute>
> </xs:complexType>
> </xs:element>
> </xs:schema>
>
> The ECORE model is generated successfully, but the Root package is
> templateDeclaration whereas TOTO is expected.
>
> I tried to avoid this, using ecore directives in the XSD to force the
> generated package name. it gives something like this:
>
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
> elementFormDefault="qualified" attributeFormDefault="unqualified"
> xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
> ecore:package="TOTO"
> ecore:nsPrefix="TOTO">
> <xs:include schemaLocation="template_declaration.xsd"/>
> ..
>
> Now, a TOTOPackage interface is generated, that defines:
>
> String eNAME = "TOTO";
> String eNS_URI =
> " file:/C:/DATA/WICO_TLS/CongaConfig/xsd/template_declaration. xsd ";
> String eNS_PREFIX = "TOTO";
>
> The URI is not correct: test.xsd is expected. Indeed, when I try to
> load a XML resource, EMF tries to map the XML against the
> template_declaration.xsd. And it fails.
>
> Has anybody encountered this problem?
> regards
>
> Laurent
>
>
>
|
|
|
Re: XSD -> ECORE conversion : problem with XSD inclusion [message #601262 is a reply to message #66406] |
Tue, 16 January 2007 12:29 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) |
Ed Merks![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=ed.merks%40gmail.com) Messages: 33201 Registered: July 2009 |
Senior Member |
|
|
Laurent,
I think you asked this same question on the EMF newsgroup... The
XSDEcoreBuilder processes all the elements and types of a schema in
arbitrary order and hence the first element or type processed for the
null namespace will determine which physical schema location is used as
the nsURI. It's probably best to define your schemas to have a
targetNamespace...
Laurent TURMEAU wrote:
> Hello,
>
> I'm creating an EMF project, and the ECORE model is imported from a
> XML schema.
> This XML schema includes another one like this:
>
> test.xsd
>
> <xs:schema xmlnss="http://www.w3.org/2001/XMLSchema"
> elementFormDefault="qualified" attributeFormDefault="unqualified">
> <xs:include schemaLocation="template_declaration.xsd"/>
> <xs:element name="TOTO">
> <xs:complexType>
> <xs:sequence>
> <xs:element ref="TITI_1" minOccurs="0"/>
> <xs:element ref="TITI_2" minOccurs="0"/>
> </xs:sequence>
> <xs:attribute name="Name" use="required">
> </xs:attribute>
> </xs:complexType>
> </xs:element>
> </xs:schema>
>
> The ECORE model is generated successfully, but the Root package is
> templateDeclaration whereas TOTO is expected.
>
> I tried to avoid this, using ecore directives in the XSD to force the
> generated package name. it gives something like this:
>
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
> elementFormDefault="qualified" attributeFormDefault="unqualified"
> xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
> ecore:package="TOTO"
> ecore:nsPrefix="TOTO">
> <xs:include schemaLocation="template_declaration.xsd"/>
> ..
>
> Now, a TOTOPackage interface is generated, that defines:
>
> String eNAME = "TOTO";
> String eNS_URI =
> " file:/C:/DATA/WICO_TLS/CongaConfig/xsd/template_declaration. xsd ";
> String eNS_PREFIX = "TOTO";
>
> The URI is not correct: test.xsd is expected. Indeed, when I try to
> load a XML resource, EMF tries to map the XML against the
> template_declaration.xsd. And it fails.
>
> Has anybody encountered this problem?
> regards
>
> Laurent
>
>
>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Powered by
FUDForum. Page generated in 0.03358 seconds