Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [QVTO] Help with syntax for assigning values to attributes defined as a certain datatype.
[QVTO] Help with syntax for assigning values to attributes defined as a certain datatype. [message #482363] Wed, 26 August 2009 11:15 Go to next message
Toñi  Reina is currently offline Toñi ReinaFriend
Messages: 209
Registered: July 2009
Senior Member
Hi again,

as you may suppose for my previous posts, I'm working with the
xhtml.ecore metamodel. That is, I'm trying to generate some xhmtl from
my source metamodel.

The problem comes when I try to assign a value for the class attribute
of the li type. The xhtml code I'm trying to obtain is something similar
to the following one:


<LI>
<A CLASS="active" TITLE="News" HREF="./1-news.html"> News</A>
</LI>

For that, I have written the following constructor:

constructor xhtml::LiType::LiType(current: siteMap::Node,
iter:siteMap::Node){

a += object xhtml::AType {

_class += 'active';

href:='./'+iter.fullFileName();
title:=guardTexts(iter.label, iter.name);
text:= title;

};

}

The error is in the line _class+='active'. class has been defined as a
NMTOKENS datatype. And this datatype has been defined having as a base
the java.util.List. I suppose the problem is the syntax, so my concrete
question is how can I assign the active value to the attribute class in
this case?

Thanks in advance,
Toñi
Re: [QVTO] Help with syntax for assigning values to attributes defined as a certain datatype. [message #482389 is a reply to message #482363] Wed, 26 August 2009 12:28 Go to previous message
Sergey Boyko is currently offline Sergey BoykoFriend
Messages: 171
Registered: July 2009
Senior Member
Hi Toñi ,

That error comes from the fact that 'java.util.List' doesn't specify
type of its' elements type. As consequence string can't be casted to
generic oclstdlib::T type.

I'd suggest here either change AType.class attribute type to NMTOKEN
with [0..-1] multiplicity or provide black-box Java library to set value
for such attributes.

Regards,
Sergey

Toñi Reina Quintero wrote:
> Hi again,
>
> as you may suppose for my previous posts, I'm working with the
> xhtml.ecore metamodel. That is, I'm trying to generate some xhmtl from
> my source metamodel.
>
> The problem comes when I try to assign a value for the class
> attribute of the li type. The xhtml code I'm trying to obtain is
> something similar to the following one:
>
>
> <LI>
> <A CLASS="active" TITLE="News" HREF="./1-news.html"> News</A>
> </LI>
>
> For that, I have written the following constructor:
>
> constructor xhtml::LiType::LiType(current: siteMap::Node,
> iter:siteMap::Node){
>
> a += object xhtml::AType {
>
> _class += 'active';
>
> href:='./'+iter.fullFileName();
> title:=guardTexts(iter.label, iter.name);
> text:= title;
>
> };
>
> }
>
> The error is in the line _class+='active'. class has been defined as a
> NMTOKENS datatype. And this datatype has been defined having as a base
> the java.util.List. I suppose the problem is the syntax, so my concrete
> question is how can I assign the active value to the attribute class in
> this case?
>
> Thanks in advance,
> Toñi
>
Previous Topic:[QVTO] Restrictions on EMF resource types
Next Topic:[ATL]How to add a binding in if-else statement
Goto Forum:
  


Current Time: Wed Apr 24 20:42:20 GMT 2024

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

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

Back to the top