Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Unable to create a valid mapping model
Unable to create a valid mapping model [message #237533] Mon, 27 July 2009 04:12
Swapnil  is currently offline Swapnil
Messages: 19
Registered: July 2009
Junior Member
I am trying to create a custom graphical editor using xml schema meta
model.

I am able to create a correct graphical model for two levels of nested
complex type elements but it doesn't work for three levels.

i.e. it works for:

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema
targetNamespace="http://www.example.org/mindmap"
xmlns:mindmap="http://www.example.org/mindmap"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore">

<xsd:element name="smc" type="mindmap:SMC"/>

<xsd:complexType name="SMC">
<xsd:sequence>
<xsd:element maxOccurs="unbounded" minOccurs="0" name="Roles"
type="mindmap:RoleType"/>
<xsd:element maxOccurs="unbounded" minOccurs="0" name="Contracts"
type="mindmap:ContractType"/>
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string"/>
</xsd:complexType>

<xsd:complexType name="RoleType">
<xsd:sequence>
<xsd:element name="Description" type="xsd:string" minOccurs="0"
maxOccurs="1"/>
</xsd:sequence>



<!-- role attributes -->
<xsd:attribute name="id" type="xsd:string" use="required"/>
<xsd:attribute name="name" type="xsd:string"/>
</xsd:complexType>

<xsd:complexType name="ContractType">
<xsd:sequence>
<xsd:element name="Abstract" type="xsd:boolean" minOccurs="0"
maxOccurs="1"/>
<xsd:element name="State" type="xsd:string" minOccurs="1"
maxOccurs="1"/>
<xsd:element name="Description" type="xsd:string" minOccurs="0"
maxOccurs="1"/>
</xsd:sequence>
<xsd:attribute ecore:reference="mindmap:RoleType" name="RoleAID">
<xsd:simpleType>
<xsd:list itemType="xsd:anyURI"/>
</xsd:simpleType>
</xsd:attribute>

<xsd:attribute ecore:reference="mindmap:RoleType" name="RoleBID">
<xsd:simpleType>
<xsd:list itemType="xsd:anyURI"/>
</xsd:simpleType>
</xsd:attribute>

<!-- contract attributes -->
<xsd:attribute name="id" type="xsd:string" use="required"/>
<xsd:attribute name="name" type="xsd:string"/>
<xsd:attribute name="type" type="xsd:string"/>
</xsd:complexType>
</xsd:schema>


but not for:

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema
targetNamespace="http://www.example.org/mindmap"
xmlns:mindmap="http://www.example.org/mindmap"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore">

<xsd:element name="smc" type="mindmap:SMC"/>

<xsd:complexType name="SMC">
<xsd:sequence>

<xsd:element name="Roles" minOccurs="0" maxOccurs="1">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Role" minOccurs="0" maxOccurs="unbounded">

<xsd:complexType >
<xsd:sequence>
<xsd:element name="Description" type="xsd:string" minOccurs="0"
maxOccurs="1"/>
</xsd:sequence>



<!-- role attributes -->
<xsd:attribute name="id" type="xsd:string" use="required"/>
<xsd:attribute name="name" type="xsd:string"/>
</xsd:complexType>

</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>

<xsd:element name="Contracts" minOccurs="0" maxOccurs="1">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Contract" minOccurs="0" maxOccurs="unbounded">


<xsd:complexType >
<xsd:sequence>
<xsd:element name="Abstract" type="xsd:boolean" minOccurs="0"
maxOccurs="1"/>
<xsd:element name="State" type="xsd:string" minOccurs="1"
maxOccurs="1"/>
<xsd:element name="Description" type="xsd:string" minOccurs="0"
maxOccurs="1"/>
</xsd:sequence>
<xsd:attribute ecore:reference="mindmap:Role" name="RoleAID">
<xsd:simpleType>
<xsd:list itemType="xsd:anyURI"/>
</xsd:simpleType>
</xsd:attribute>

<xsd:attribute ecore:reference="mindmap:Role" name="RoleBID">
<xsd:simpleType>
<xsd:list itemType="xsd:anyURI"/>
</xsd:simpleType>
</xsd:attribute>

<!-- contract attributes -->
<xsd:attribute name="id" type="xsd:string" use="required"/>
<xsd:attribute name="name" type="xsd:string"/>
<xsd:attribute name="type" type="xsd:string"/>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>



</xsd:sequence>
<xsd:attribute name="name" type="xsd:string"/>
</xsd:complexType>




</xsd:schema>



Any help much appreciated.



Cheers,

Swapnil
Previous Topic:Cascade deletion in EMF/GMF
Next Topic:patch for copy/paste
Goto Forum:
  


Current Time: Sun Apr 20 09:30:27 EDT 2014

Powered by FUDForum. Page generated in 0.03631 seconds