org.eclipse.actf.model.dom
Class DomModel

java.lang.Object
  extended by org.eclipse.actf.model.AbstractModel
      extended by org.eclipse.actf.model.dom.DomModel
All Implemented Interfaces:
IModel

public class DomModel
extends AbstractModel

serves as a model of a hierarchy of nodes that represent the basic elements of an XML document. Nodes are represented by instances of org.w3c.dom.Node instances as specified by the W3C DOM Level 2 specification.

Objects passed to the methods of this class should be instances of org.w3c.dom.Node. Clients can extend this class to validate XML or HTML documents.

Author:
Mike Squillace
See Also:
Node, Document Object Model (DOM) Level 2 Core Specification

Field Summary
static String DOM_MODEL
           
 
Fields inherited from class org.eclipse.actf.model.AbstractModel
baseType, configuration, locator, nodeToTypeNameMap, runtimeContext, treeNodeWalker
 
Constructor Summary
DomModel()
          new DomModel instance; default is org.eclipse.actf.core.config.Configuration.DOM_MODEL
DomModel(String type)
           
 
Method Summary
 INodeLocator getNodeLocator()
          retrieves a locator for finding and identifying nodes in the model.
 String getNodeName(Object element)
          return the short name of this element. The id for an element is model-specific. For example, it may be the tag name of an element of a model representing a structure that conforms to W3the C DOM specification or the simple class name of the object. returns the qualified class name (i.e. without the package name) of the given element returns the tag name of this element if it is a W3C Dom element
 String[] getPackageNames()
          returns an array of the names of packages to be imported by CodeProcessors. Includes packages: java.lang org.w3c.dom
 String getTypeName(String nodeName)
          returns the type name associated with this nodeName. The nodeName parameter is most frequently formed by calling getNodeName. The name returned identifies the type that is represented by this node name in the graph.

If the specified nodeName was not obtained from getNodeName, then implementers should make a rough guess regarding the underlying type on the basis of the package names associated with this model via getPackageNames.

returns the original class name from which this node name was derived or, if unsuccessful, tries to form the correct class based on the package names associated with this implementation always returns org.w3c.dom.Element
 boolean isTopDown()
           
 
Methods inherited from class org.eclipse.actf.model.AbstractModel
addModelChangeListener, fireModelChangeEvent, getBaseType, getDefaultAliasPrefix, getName, getNodeId, getNodeWalker, getOrder, removeModelChangeListener, setFilters, setModelType, setNodeID
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DOM_MODEL

public static final String DOM_MODEL
See Also:
Constant Field Values
Constructor Detail

DomModel

public DomModel()
new DomModel instance; default is org.eclipse.actf.core.config.Configuration.DOM_MODEL


DomModel

public DomModel(String type)
Method Detail

getNodeName

public String getNodeName(Object element)
return the short name of this element. The id for an element is model-specific. For example, it may be the tag name of an element of a model representing a structure that conforms to W3the C DOM specification or the simple class name of the object. returns the qualified class name (i.e. without the package name) of the given element returns the tag name of this element if it is a W3C Dom element

Specified by:
getNodeName in interface IModel
Overrides:
getNodeName in class AbstractModel
Parameters:
element - - element for which name is desired
Returns:
name of element or null if not available

getTypeName

public String getTypeName(String nodeName)
returns the type name associated with this nodeName. The nodeName parameter is most frequently formed by calling getNodeName. The name returned identifies the type that is represented by this node name in the graph.

If the specified nodeName was not obtained from getNodeName, then implementers should make a rough guess regarding the underlying type on the basis of the package names associated with this model via getPackageNames.

returns the original class name from which this node name was derived or, if unsuccessful, tries to form the correct class based on the package names associated with this implementation always returns org.w3c.dom.Element

Specified by:
getTypeName in interface IModel
Overrides:
getTypeName in class AbstractModel
Parameters:
nodeName - - as returned by getNodeName
Returns:
type name for the node name specified
See Also:
#getNodeName(Object)Object), IModel.getPackageNames()

getPackageNames

public String[] getPackageNames()
returns an array of the names of packages to be imported by CodeProcessors. Any CodeProcessor used in the context of an IModel will, upon its instantiation and initialization, import the list of packages and make their traditional short-forms available. (Of course, short-forms are language-dependent.) Each element of the array is only a name for a package (e.g. 'my.java.package').

Includes packages:

Returns:
array of names of packages to be imported by a CodeProcessor or an array of length 0 for no imports

isTopDown

public boolean isTopDown()

getNodeLocator

public INodeLocator getNodeLocator()
Description copied from class: AbstractModel
retrieves a locator for finding and identifying nodes in the model. The locator can provide an XPath expression that describes a node in the model or, given a valid XPath expression, find an object in the model.

Specified by:
getNodeLocator in interface IModel
Overrides:
getNodeLocator in class AbstractModel
Returns:
node locator