[ATL] probem with XML model [message #658857] |
Thu, 10 March 2011 00:24  |
Eclipse User |
|
|
|
Hi all,
I'm trying to write a very simple XML file that conforms to XML.ecore metamodel, but when I launched a configuration, it gave me this error:
Error loading platform:/resource/SequenceTest-Mar08-2011/source/parameters -1.xml: org.eclipse.emf.ecore.xmi.ClassNotFoundException: Class 'Node' is not found or is abstract. (platform:/resource/SequenceTest-Mar08-2011/source/parameter s-1.xml, 3, 15)
This is the input model to ATL transformation
<?xml version="1.0" encoding="ASCII"?>
<Root xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="XML">
<children>
<children name = 'lifeLine' value = 'Cust'/>
<children name = 'message' value = 'list'/>
</children>
</Root>
This is the metamodel in km3 format, but I use the ecore one.
-- @name XML
-- @version 1.1
-- @domains XML
-- @description This metamodel defines a subset of Extensible Markup Language (XML) and particulary XML document. It describes an XML document composed of one root node. Node is an abstract class having two direct children, namely ElementNode and AttributeNode. ElementNode represents the tags, for example a tag named xml: <xml></xml>. ElementNodes can be composed of many Nodes. AttributeNode represents attributes, which can be found in a tag, for example the attr attribute: <xml attr="value of attr"/>. ElementNode has two sub classes, namely RootNode and TextNode. RootNode is the root element. The TextNode is a particular node, which does not look like a tag; it is only a string of characters.
package XML {
abstract class Node {
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;
reference parent[0-1] : Element oppositeOf children;
}
class Attribute extends Node {}
class Text extends Node {}
class Element extends Node {
reference children[*] ordered container : Node oppositeOf parent;
}
class Root extends Element {}
}
package PrimitiveTypes {
datatype Boolean;
datatype Integer;
datatype String;
}
Does anyone know what is wrong with the XML file?
Thanks in advance,
Sally
|
|
|
Re: [ATL] probem with XML model [message #658959 is a reply to message #658857] |
Thu, 10 March 2011 09:42   |
Eclipse User |
|
|
|
Sally,
Comments below.
Sally wrote:
> Hi all,
>
> I'm trying to write a very simple XML file that conforms to XML.ecore
> metamodel, but when I launched a configuration, it gave me this error:
>
> Error loading
> platform:/resource/SequenceTest-Mar08-2011/source/parameters -1.xml:
> org.eclipse.emf.ecore.xmi.ClassNotFoundException: Class 'Node' is not
> found or is abstract.
> (platform:/resource/SequenceTest-Mar08-2011/source/parameter s-1.xml,
> 3, 15)
>
> This is the input model to ATL transformation
> <?xml version="1.0" encoding="ASCII"?>
> <Root xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="XML">
This doesn't look like XMI because the root element is qualified with
"XML" as the namespace. Maybe ATL is okay with that...
> <children>
Doesn't this need an xsi:type/xmi:type so that the parse knows which
subclass of Node to create. It can't create a Node because it's
abstract. The parser definitely seems to not be liking that.
> <children name = 'lifeLine' value = 'Cust'/>
> <children name = 'message' value = 'list'/>
> </children>
> </Root>
>
> This is the metamodel in km3 format, but I use the ecore one. --
> @name XML -- @version 1.1
> -- @domains XML
> -- @description This metamodel defines a subset of Extensible
> Markup Language (XML) and particulary XML document. It describes an
> XML document composed of one root node. Node is an abstract class
> having two direct children, namely ElementNode and AttributeNode.
> ElementNode represents the tags, for example a tag named xml:
> <xml></xml>. ElementNodes can be composed of many Nodes. AttributeNode
> represents attributes, which can be found in a tag, for example the
> attr attribute: <xml attr="value of attr"/>. ElementNode has two sub
> classes, namely RootNode and TextNode. RootNode is the root element.
> The TextNode is a particular node, which does not look like a tag; it
> is only a string of characters.
>
> package XML {
> abstract class Node {
> 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;
> reference parent[0-1] : Element oppositeOf children;
> }
> class Attribute extends Node {}
> class Text extends Node {}
> class Element extends Node {
> reference children[*] ordered container : Node oppositeOf parent;
> }
> class Root extends Element {}
> }
>
> package PrimitiveTypes {
> datatype Boolean;
> datatype Integer;
> datatype String;
> }
>
> Does anyone know what is wrong with the XML file?
>
> Thanks in advance,
>
> Sally
>
|
|
|
Re: [ATL] probem with XML model [message #659212 is a reply to message #658857] |
Fri, 11 March 2011 10:05  |
Eclipse User |
|
|
|
Thanks Ed. I actually tried this, but I still get the same error.
<children xsi:type= 'XML:Attribute' name = 'lifeLine' value = 'Cust'/>
I took this XML model and metamodel from the ATL examples, I'm trying now to write my XML metamodel in km3, then inject it to ecore metamodel, but I think a plugin is missing as when right click on the km3 file there is no icon to inject to ecore.
Does anyone know what plugin is needed to inject a km3 model to ecore metamodel. I'm using eclipse 3.5.2 and ATL 3.0.2
Thanks,
Sally
|
|
|
Powered by
FUDForum. Page generated in 0.06529 seconds