Hi all,
I am having problem with output format of the XML file.
The xml.km3 file is like this
package PrimitiveTypes {
datatype Boolean;
datatype Integer;
datatype String;
}
package XML {
abstract class Node {
reference parent[0-1] : Element oppositeOf children;
attribute startLine[0-1] : Integer;
attribute startColumn[0-1] : Integer;
attribute endLine[0-1] : Integer;
attribute endColumn[0-1] : Integer;
attribute name : String;
attribute value : String;
}
class Attribute extends Node {
}
class Text extends Node {
}
class Element extends Node {
reference children[*] ordered container : Node oppositeOf parent;
}
class Root extends Element {
}
}
here is my XMI input file for the ATL code presented below.
sample XMI (IN:BPEL) file
<?xml version="1.0" encoding="ISO-8859-1"?>
<BPEL:Process xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:BPEL="uri:BPEL.ecore" name="ManRoleType" targetNameSpace="http://example .org/build2order">
This is my ATL file with the rule.
--******************ATL FILE ************
module BPEL2XML;
create OUT : XML from IN : BPEL;
rule Process2Root{
from
s : BPEL!Process( ]
s.oclIsTypeOf(BPEL!Process)
)
to
t : XML!Root(
name <- 'process',
children <- Sequence{xmlns, name}
),
xmlns : XML!Attribute(
name <- 'xmlns',
value <- 'http://myproject.com/wsbpel'
),
name : XML!Attribute(
name <- 'name',
value <- s.name
)
************************************************** *******
This is my output which is not as I had expected.
Output
<?xml version="1.0" encoding="ISO-8859-1"?>
<Root xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="XML" name="process">
<children xsi:type="Attribute" name="xmlns" value="http://docs.oasis-open.org/wsbpel/2.0/process/abstract"/>
<children xsi:type="Attribute" name="name" value="ManRoleType"/>
</Root>
This is my expected output.
-----------> Expected output <---------------------
Expected Output
<?xml version="1.0" encoding="ISO-8859-1"?>
<process name="ManRoleType xmlns="http://myproject.com/wsbpel">
</process>
What sort of changes should I make in ATL rule so that I will get the expected output of BPEL file.
Thanking in advance!
[Updated on: Thu, 12 August 2010 22:23] by Moderator