Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [ATL] Getting the text of a xml element
[ATL] Getting the text of a xml element [message #42897] Tue, 29 May 2007 14:05 Go to next message
Eclipse UserFriend
Originally posted by: erik_becker.gmx.de

Hi all,

I'm working on the transformation of a XML-based model. Is there a way
to get the text value of a XML element / tag? I need this value so set
attribute value of my target model.

I used the XML Injector to get an ecore-based instance from my source
XML model. My helper to get the text looks like this:

helper context XML!Element def: getText() : String =
self.children->select(e | e.oclIsKindOf(XML!Text))->first();

This work fine so far but now I don't know how to get the text value.
Could anyone help?

Greetings

Erik
Re: [ATL] Getting the text of a xml element [message #42927 is a reply to message #42897] Tue, 29 May 2007 15:44 Go to previous messageGo to next message
Ã?ric Vépa is currently offline Ã?ric VépaFriend
Messages: 16
Registered: July 2009
Junior Member
Hi Erik,

You can access the value of any XML!Node (or subclasses) using the
attribute "value".

For more details, see the XML metamodel available in the Zoo
(http://www.eclipse.org/gmt/am3/zoos/atlanticZoo/#XML).


Erik Becker wrote:
> Hi all,
>
> I'm working on the transformation of a XML-based model. Is there a way
> to get the text value of a XML element / tag? I need this value so set
> attribute value of my target model.
>
> I used the XML Injector to get an ecore-based instance from my source
> XML model. My helper to get the text looks like this:
>
> helper context XML!Element def: getText() : String =
> self.children->select(e | e.oclIsKindOf(XML!Text))->first();
>
> This work fine so far but now I don't know how to get the text value.
> Could anyone help?
>
> Greetings
>
> Erik


--
Éric Vépa

SODIUS
6, rue de Cornouaille - BP 91941
44319 Nantes, France
Email: evepa@sodius.com

www.mdworkbench.com
Draw more value from your models
Re: [ATL] Getting the text of a xml element [message #42958 is a reply to message #42927] Tue, 29 May 2007 16:44 Go to previous message
Eclipse UserFriend
Originally posted by: erik_becker.gmx.de

oh thanks and sorry, i tried already 'Value' and this didn't work but
'value' i haven't tried.

greetings

erik

Éric Vépa schrieb:
> Hi Erik,
>
> You can access the value of any XML!Node (or subclasses) using the
> attribute "value".
>
> For more details, see the XML metamodel available in the Zoo
> (http://www.eclipse.org/gmt/am3/zoos/atlanticZoo/#XML).
>
>
> Erik Becker wrote:
>> Hi all,
>>
>> I'm working on the transformation of a XML-based model. Is there a way
>> to get the text value of a XML element / tag? I need this value so set
>> attribute value of my target model.
>>
>> I used the XML Injector to get an ecore-based instance from my source
>> XML model. My helper to get the text looks like this:
>>
>> helper context XML!Element def: getText() : String =
>> self.children->select(e | e.oclIsKindOf(XML!Text))->first();
>>
>> This work fine so far but now I don't know how to get the text value.
>> Could anyone help?
>>
>> Greetings
>>
>> Erik
Previous Topic:[ATL] rules library
Next Topic:[ATL] How to create a new model element that contains a text.
Goto Forum:
  


Current Time: Mon Sep 23 09:08:03 GMT 2024

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

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

Back to the top