[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.modeling.m2m] Re: [QVTO] Help with syntax for assigning values to attributes defined as a certain datatype.

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