Resolving element references after injection [message #384774] |
Tue, 12 August 2008 16:56 |
Eclipse User |
|
|
|
Originally posted by: mozafara.cs.man.ac.uk
Hi,
I am working on a project where I use TCS to transform textual syntax of
a DSL into a model, then the model is transformed into c++ code using
JET2 templates. JET loads the injected xmi file from TCS output and the
final code is generated by appropriate XPath queries embedded in jet
templates.
I have an issue with the way TCS serializes non-container references.
For example, take notice how the following km3 snippet is represented in
the model.
class Terminator {
reference nextstate : State;
}
the corresponding TCS template is:
template Terminator :
"nextstate" reference{refersTo=name}
;
after injection we get:
<terminator location="7:2-7:21" nextstate="//@process/@state.0"/>
the value of "nextstate" attribute is a reference to the the instance of
a "state" class in the serialized tree.
The big issue is that the expression is not XPath compatible and I have
to resort to ugly hacks to convert it into a valid path expression. The
XPath equivalent of the above example would be "//process/state[1]".
Is there a way to produce XPath friendly path references from TCS
injections? What does the current format stand for?
|
|
|
Powered by
FUDForum. Page generated in 0.04133 seconds