Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Ecore genaration via xsd have some problems.(Generated ecore (based on xsd) does only contain ComplexType definitions and SimpleType definitions.)
Ecore genaration via xsd have some problems. [message #774172] Tue, 03 January 2012 12:12 Go to next message
kalpa Missing name is currently offline kalpa Missing nameFriend
Messages: 3
Registered: January 2012
Location: Colombo
Junior Member
hi,

if I use ComplexType to describe element
 <xs:element name="property">
         <xs:complexType ecore:name="ConfigurationProperty">
              <xs:simpleContent>
                   <xs:extension base="xs:string">
                        <xs:attribute name="name" type="xs:string" use="required" />
                   </xs:extension>
              </xs:simpleContent>
         </xs:complexType>
     </xs:element> 


generated Ecore contains entity like below.As a EClass.


If I use SimpleType to describe the element
 <xs:element name="description" minOccurs="0" maxOccurs="1">
		<xs:simpleType>

    		<xs:restriction base="xs:string"/>

		</xs:simpleType>
	   </xs:element>


EMF take it as EDataType


but if I use just element.
 <xs:element name="description" type="xs:string" minOccurs="0" maxOccurs="1">


I can not refer that element generated ecore dose not contains only is as a attribute of the parent element.But i want it as a Entity as in the first picture because I am using EMFText for define some DSL but in the rule definition I can not refer those "elements" because they not have real reference in the .genmodle. what do i do for this.is some thing wrong with my usage.?
Re: Ecore genaration via xsd have some problems. [message #774261 is a reply to message #774172] Tue, 03 January 2012 15:59 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33218
Registered: July 2009
Senior Member
Comments below.

On 03/01/2012 1:12 PM, kalpa Mising name wrote:
> hi,
>
> if I use ComplexType to describe element
> <xs:element name="property">
> <xs:complexType ecore:name="ConfigurationProperty">
> <xs:simpleContent>
> <xs:extension base="xs:string">
> <xs:attribute name="name" type="xs:string" use="required" />
> </xs:extension>
> </xs:simpleContent>
> </xs:complexType>
> </xs:element>
> generated Ecore contains entity like below.As a EClass.
>
>
> If I use SimpleType to describe the element
> <xs:element name="description" minOccurs="0" maxOccurs="1">
> <xs:simpleType>
>
> <xs:restriction base="xs:string"/>
>
> </xs:simpleType>
> </xs:element>
>
> EMF take it as EDataType
>
> but if I use just element.
> <xs:element name="description" type="xs:string" minOccurs="0"
> maxOccurs="1">
>
> I can not refer that element generated ecore dose not contains only is
> as a attribute of the parent element.But i want it as a Entity as in
> the first picture because I am using EMFText for define some DSL but
> in the rule definition I can not refer those "elements" because they
> not have real reference in the .genmodle. what do i do for this.is
> some thing wrong with my usage.?
So the first approach is the one you should take. I.e., if you want an
EObject that holds the value, you have to use a complex type, not a
simple type.


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:Diagnostician#validate fails with NPE in EcoreUtil#getURI/2925
Next Topic:reference ecore model path of a different ecore model
Goto Forum:
  


Current Time: Thu Sep 26 02:24:51 GMT 2024

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

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

Back to the top