Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Export Ecore model to XML Schema without EDataTyps
Export Ecore model to XML Schema without EDataTyps [message #650528] Tue, 25 January 2011 12:38 Go to next message
Susann is currently offline SusannFriend
Messages: 4
Registered: January 2011
Junior Member
Hi,

I've a problem with exporting an ecore model to a XML Schema. When I do so by using the "Export Model ...." function of an genmodel the XSD file uses the EDataTypes for attributes instead of the java types.

Here is my class i want to export as XML Schema:
Class: Customer
Attribute: name (type: EString)
Atttribute: id (type:EInt)

At this point I've the first question: why can I not use the normal type String and int?

Then I'Ve created an genmodel from this ecore model and export it as XML Schema.

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<xsd:schema xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:ibm="http://ibm.com.de" xmlns:xsd="http://www.w3.org/2001/XMLSchema" ecore:nsPrefix="ibm" ecore:package="domain01" targetNamespace="http://ibm.com.de">
<xsd:import namespace="http://www.eclipse.org/emf/2002/Ecore" schemaLocation="platform:/plugin/org.eclipse.emf.ecore/model/Ecore.xsd "/>
<xsd:complexType ecore:name="customer" name="customer">
<xsd:simpleContent ecore:name="name">
<xsd:extension base="ecore:EString">
<xsd:attribute ecore:unsettable="false" name="id" type="ecore:EInt"/>
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
</xsd:schema>

What I'm doing wrong? Do I have to import any Library so I can use the normal java types already during modelling my ecore model?
So I think you notice that I completely new at this topic, so thank you for your help.
Re: Export Ecore model to XML Schema without EDataTyps [message #650610 is a reply to message #650528] Tue, 25 January 2011 17:08 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33216
Registered: July 2009
Senior Member
Comments below.

fritzschi1@hotmail.com wrote:
> Hi,
>
> I've a problem with exporting an ecore model to a XML Schema. When I
> do so by using the "Export Model ...." function of an genmodel the XSD
> file uses the EDataTypes for attributes instead of the java types.
How can a schema use Java types?
> Here is my class i want to export as XML Schema:
> Class: Customer
> Attribute: name (type: EString)
> Atttribute: id (type:EInt)
>
> At this point I've the first question: why can I not use the normal
> type String and int?
Your Ecore model will have to use the types from XMLTypePackage; that
package has an EDataType for every XML Schema built-in type.
> Then I'Ve created an genmodel from this ecore model and export it as
> XML Schema.
> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
> <xsd:schema xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
> xmlns:ibm="http://ibm.com.de"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema" ecore:nsPrefix="ibm"
> ecore:package="domain01" targetNamespace="http://ibm.com.de">
> <xsd:import namespace="http://www.eclipse.org/emf/2002/Ecore"
> schemaLocation="platform:/plugin/org.eclipse.emf.ecore/model/Ecore.xsd
> "/>
> <xsd:complexType ecore:name="customer" name="customer">
> <xsd:simpleContent ecore:name="name">
> <xsd:extension base="ecore:EString">
> <xsd:attribute ecore:unsettable="false" name="id"
> type="ecore:EInt"/>
> </xsd:extension>
> </xsd:simpleContent>
> </xsd:complexType>
> </xsd:schema>
>
> What I'm doing wrong?
It looks as I would expect, given you've used Ecore's built-in types.
> Do I have to import any Library so I can use the normal java types
> already during modelling my ecore model?
I guess you mean the XML Schema built-in types because schemas don't use
Java types.
> So I think you notice that I completely new at this topic, so thank
> you for your help.
Indeed.


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Export Ecore model to XML Schema without EDataTyps [message #650631 is a reply to message #650610] Tue, 25 January 2011 18:59 Go to previous message
Susann is currently offline SusannFriend
Messages: 4
Registered: January 2011
Junior Member
Hi Ed,

thank you for your response. You're right I am using the Ecore's built-in types and I want to use the XMLTypePackage types.

But you already solved my problem in the other thread where you give me the hint that I can "import" the XMLTypePackage types by using "Load resources ..." --> Browse registered packages

Thanks a lot. Smile
Previous Topic:Generating Plain XSD from Ecore Model
Next Topic:Problems loading EMF repositories (SOLVED)
Goto Forum:
  


Current Time: Thu Sep 19 23:34:10 GMT 2024

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

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

Back to the top