Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » Dealing with mixed types in XPAND for XSD(FeatureMaps?)
icon5.gif  Dealing with mixed types in XPAND for XSD [message #494831] Mon, 02 November 2009 20:43 Go to next message
Marco  is currently offline Marco Friend
Messages: 216
Registered: August 2009
Senior Member
Hi,

I know I am missing detailed understanding of EMF and XSD but I just want to use it quickly.

I elaborated the following code in my XPAND:
«DEFINE element FOR ElementType-»
«IF expression.size > 0-»
(«EXPAND element FOR expression.get(0).argList.element.get(0)-»
 «expression.get(0).operation.mixed.get(0).toString().split('text=').get(1)-»
 «EXPAND element FOR expression.get(0).argList.element.get(1)-»
)«ENDIF-»
«IF type == "string"-»
«mixed.get(0).toString().split('text=').get(1)-»
«ENDIF-»
«IF constant.size > 0-»
«IF constant.get(0).type == "string"-»"«ENDIF-»
«constant.get(0).mixed.get(0).toString().split('text=').get(1)-»
«IF constant.get(0).type == "string"-»"«ENDIF-»
«ENDIF-»
«ENDDEFINE»


It works but I have the strong feeling that there is a smarter way to handle the mixed types. Would you be so kind to give me a hint or even better show me how to phrase
«expression.get(0).operation.mixed.get(0).toString().split( 'text=').get(1)-»
correctly.

br,
Marco
Re: Dealing with mixed types in XPAND for XSD [message #495443 is a reply to message #494831] Wed, 04 November 2009 22:09 Go to previous messageGo to next message
Moritz Eysholdt is currently offline Moritz EysholdtFriend
Messages: 161
Registered: July 2009
Location: Kiel, Germany
Senior Member
Hi Marco,

how about
«expression.get(0).operation.mixed.text.get(0)-»
?

and, did you notice that you could also write
«EXPAND element FOREARCH expression.get(0).argList.element-»
instead of
«EXPAND element FOR expression.get(0).argList.element.get(0)-»
in case you want to process all items from a list.

cheers,
Moritz

> Hi,
>
> I know I am missing detailed understanding of EMF and XSD but I just
> want to use it quickly.
>
> I elaborated the following code in my XPAND:
>
> «DEFINE element FOR ElementType-»
> «IF expression.size > 0-»
> («EXPAND element FOR expression.get(0).argList.element.get(0)-»
> «expression.get(0).operation.mixed.get(0).toString().split( 'text=').get(1)-»
>
> «EXPAND element FOR expression.get(0).argList.element.get(1)-»
> )«ENDIF-»
> «IF type == "string"-»
> «mixed.get(0).toString().split('text=').get(1)-»
> «ENDIF-»
> «IF constant.size > 0-»
> «IF constant.get(0).type == "string"-»"«ENDIF-»
> «constant.get(0).mixed.get(0).toString().split('text=').get (1)-»
> «IF constant.get(0).type == "string"-»"«ENDIF-»
> «ENDIF-»
> «ENDDEFINE»
>
>
> It works but I have the strong feeling that there is a smarter way to
> handle the mixed types. Would you be so kind to give me a hint or even
> better show me how to phrase
> «expression.get(0).operation.mixed.get(0).toString().split(
> 'text=').get(1)-»
> correctly.
>
> br,
> Marco
>


--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com
Re: Dealing with mixed types in XPAND for XSD [message #495711 is a reply to message #495443] Thu, 05 November 2009 19:56 Go to previous message
Marco  is currently offline Marco Friend
Messages: 216
Registered: August 2009
Senior Member
Hi Moritz,

Thanks for the suggestion.

The auto-completion suggests text List[String] - XMLFeatureMap as option. But the workflow then produces an error:
EvaluationException : Couldn't find property 'text' for inner type EFeatureMapEntry'

I do not understand this.

br,
m
Previous Topic:GRAVE: Error in Component of type org.eclipse.xpand2.Generator:
Next Topic:[xpand] reference to metamodel not understood by generator
Goto Forum:
  


Current Time: Wed Oct 16 01:41:15 GMT 2024

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

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

Back to the top