Hi,
I wrote a transformation and get weird results. My transformation looks like this:
//Start Model Transformation here.
create Entity transformDocumentRoot(DocumentRoot documentRoot):
documentRoot.specifications.specification.transformSpecificationType(this) ->
this.setName("I'm a DocumentRoot!")
;
Void transformSpecificationType(SpecificationType specification, Entity parent):
parent.childEntities.addAll(specification.blockDiagramSpecification.diagramElements.diagramElement.transformDiagramElementT())
;
create Entity transformDiagramElementT(DiagramElementT diagramElementT):
this.setName("I'm a DiagramElementT!")
;
My input looks like this (abbreviated version):
<?xml version="1.0" encoding="UTF-8"?>
<ComponentSpecification:Specifications ...>
<Layout ...>
...
</Layout>
<Specification name="Main" public="public">
<BlockDiagramSpecification>
<ESDLCode>
...
</ESDLCode>
<DiagramElements>
<DiagramElement>
...
</DiagramElement>
<DiagramElement>
...
</DiagramElement>
<DiagramElement>
...
</DiagramElement>
<DiagramElement>
...
</DiagramElement>
<DiagramElement>
...
</DiagramElement>
<DiagramElement>
...
</DiagramElement>
<DiagramElement>
...
</DiagramElement>
</DiagramElements>
</BlockDiagramSpecification>
</Specification>
<Signature ... >
...
</Signature>
</ComponentSpecification:Specifications>
And the output looks like this:
<?xml version="1.0" encoding="ASCII"?>
<kaom:Entity xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:kaom="http://kieler.cs.cau.de/KAOM" xsi:schemaLocation="http://kieler.cs.cau.de/KAOM java://de.cau.cs.kieler.kaom.KaomPackage" name="I'm a DocumentRoot!"/>
As you can see, the DiagramElement objects are missing, although I tried to collect them by iterating over the list of Specification objects and over the lists of DiagramElement objects in every list of Specification objects. (In this example there is only one Specification object in the Specifications object (note the additional 's').)
[Updated on: Wed, 21 July 2010 09:23]
Report message to a moderator