Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » XSD --> Ecore question
XSD --> Ecore question [message #915727] Mon, 17 September 2012 17:10 Go to next message
Martin Taal is currently offline Martin Taal
Messages: 5329
Registered: July 2009
Senior Member
Hi,
I have a question about this xsd construct:
<xsd:sequence>
<xsd:element name="endName" type="AttributeType" maxOccurs="unbounded">
</xsd:element>
</xsd:sequence>

When I generate code in EMF for this construct I get a AttributeListType and an AttributeType eClass. This is fine.
However in Teneo I get these eclasses:
AttributeListType
AttributeType
AttributeListType1
AttributeType1

So twice with a postfix 1. I use the XSDEcoreBuilder to translate the xsd to ecore:
final XSDEcoreBuilder ecoreBuilder = new XSDEcoreBuilder(new BasicExtendedMetaData(EPackage.Registry.INSTANCE));
and then do this:
final org.eclipse.emf.common.util.URI emfURI = org.eclipse.emf.common.util.URI.createURI(uri.toString());
final Collection<EObject> eObjects = ecoreBuilder.generate(emfURI);

Should/can I do anything special to prevent the *1 eclasses from being created?


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@xxxxxxxx - mtaal@xxxxxxxx
Web: www.springsite.com - www.elver.org
Re: XSD --&gt; Ecore question [message #915846 is a reply to message #915727] Tue, 18 September 2012 00:26 Go to previous message
Ed Merks is currently offline Ed Merks
Messages: 25999
Registered: July 2009
Senior Member
Martin,

It's sounds like there's more going on than just this snippet. Such
names must come from resolving name conflicts so have a look at why
you'd get to the line " eNamedElement.setName(name + index);" in
org.eclipse.xsd.ecore.XSDEcoreBuilder.resolveNameConflict(Map<String, ?
extends ENamedElement>, ENamedElement, String)


On 17/09/2012 11:10 PM, Martin Taal wrote:
> Hi,
> I have a question about this xsd construct:
> <xsd:sequence>
> <xsd:element name="endName" type="AttributeType"
> maxOccurs="unbounded">
> </xsd:element>
> </xsd:sequence>
>
> When I generate code in EMF for this construct I get a
> AttributeListType and an AttributeType eClass. This is fine. However
> in Teneo I get these eclasses:
> AttributeListType
> AttributeType
> AttributeListType1
> AttributeType1
>
> So twice with a postfix 1. I use the XSDEcoreBuilder to translate the
> xsd to ecore:
> final XSDEcoreBuilder ecoreBuilder = new XSDEcoreBuilder(new
> BasicExtendedMetaData(EPackage.Registry.INSTANCE));
> and then do this:
> final org.eclipse.emf.common.util.URI emfURI =
> org.eclipse.emf.common.util.URI.createURI(uri.toString());
> final Collection<EObject> eObjects =
> ecoreBuilder.generate(emfURI);
>
> Should/can I do anything special to prevent the *1 eclasses from being
> created?
>
>
Previous Topic:Problems with targetNamespace
Next Topic:[CDO] Reducing the debug trace on server and client
Goto Forum:
  


Current Time: Fri Aug 22 01:55:23 EDT 2014

Powered by FUDForum. Page generated in 0.01711 seconds