[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.tools.emf] Re: complexType not translated to ECLass

Yeah you are right :-)

I was looking at the wrong xml file :-(, :-(

Sorry for wasting your time with this.

gr. Martin

Ed Merks wrote:
Martin,

Comments below.

Martin Taal wrote:
Hi Ed,
I have a xsd for which it seems that certain complex types are not translated to an eclass (in this case the AddressType and EmployerType).
That seems not possible. :-P
Is there maybe an option I should set when loading the xsd?

Here is the schema:
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema";
            xmlns="http://mynamespace";
            targetNamespace="http://mynamespace";>

  <xsd:element name="Person" type="PersonType"/>

  <xsd:complexType name="PersonType">
    <xsd:sequence>
      <xsd:element name="MyExplicitAnyType" type="xsd:anyType"/>
      <xsd:element name="MyImplicitAnyType"/>
    </xsd:sequence>
  </xsd:complexType>

  <xsd:complexType name="EmployerType">
    <xsd:sequence>
      <xsd:element name="EmployerName" type="xsd:string"/>
      <xsd:element name="EmployerAddress" type="AddressType"/>
    </xsd:sequence>
  </xsd:complexType>

  <xsd:complexType name="AddressType">
    <xsd:sequence>
      <xsd:element name="Zip" type="xsd:integer"/>
    </xsd:sequence>
    <xsd:attribute name="Label" type="xsd:string"/>
  </xsd:complexType>
</xsd:schema>

Then with this xml:

<n1:Person xmlns:n1="http://mynamespace"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xmlns:xsd="http://www.w3.org/2001/XMLSchema";>
<MyExplicitAnyType xsi:type="n1:EmployerType">
<EmployerName>SomeCompany</EmployerName>
<EmployerAddress Label="work">
<Zip>54321</Zip>
</EmployerAddress>
</MyExplicitAnyType>
<MyImplicitAnyType xsi:type="n1:AddressType" Label="home">
<Zip>12345</Zip>
</MyImplicitAnyType>
</n1:Person>


I get the exception:
Fails to load with: Class 'AddressType' is not found or is abstract

I use the XSDEcoreBuilder to translate the above xsd to an EPackage in-memory. So maybe I need to specify certain options there?
I generated the model and the *.tests project and was able to use the generated MynamespaceExample.java to load the above instance. You're sure you're using the generated resource factory (or one with the same options to do the loading)?


--

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@xxxxxxxxxxxxxx - mtaal@xxxxxxxxx
Web: www.springsite.com - www.elver.org