-- @name XML
-- @version 1.1
-- @domains XML
-- @authors Peter Rosendal (peter.rosenthal@univ-nantes.fr)
-- @date 2005/06/13
-- @description This metamodel defines a subset of the Extensible Markup Language (XML). It describes an XML document with 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: . ElementNodes can be composed of many Nodes. AttributeNode represents attributes, which can be found in a tag, for example the attr attribute: . 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;
}