[ATL] probem with XML model [message #658857] |
Thu, 10 March 2011 05:24 |
Sally Messages: 16 Registered: March 2011 |
Junior Member |
|
|
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 14:42 |
Ed Merks Messages: 33140 Registered: July 2009 |
Senior Member |
|
|
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
>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
|
Powered by
FUDForum. Page generated in 0.03421 seconds