org.translet.builder
Class NodeCreator

java.lang.Object
  |
  +--org.translet.builder.NodeCreator
All Implemented Interfaces:
LocationPathHandler

public class NodeCreator
extends Object
implements LocationPathHandler

Default implementation of the LocationPathHandler that creates the nodes belonging to the XML document.


Fields inherited from interface org.translet.processor.LocationPathHandler
AXES_ANCESTOR, AXES_ANCESTOR_OR_SELF, AXES_ATTRIBUTE, AXES_CHILD, AXES_DESCENDENT, AXES_DESCENDENT_OR_SELF, AXES_FOLLOWING, AXES_FOLLOWING_SIBLING, AXES_NAMESPACE, AXES_PARENT, AXES_PRECEDING, AXES_PRECEDING_SIBLING, AXES_SELF, AXES_UNKNOWN
 
Constructor Summary
NodeCreator()
          Uses a new DOM document.
NodeCreator(Document doc)
           
 
Method Summary
 void attribute(String attrName)
          Indicates an attribute in the location path.
 void attributeInPredicate(String attrName)
          Indicates that an attribute was found with in the predicate
 void axes(short axescode)
          Indicates that an axes was encountered.
 Node createNode(String nodeName, String namespaceURI, short nodeType)
          Creates a node of the specified type.
 void data(String value)
          Sets the data.
 void endLocationPath()
          Indicates the closing of a LocationPath.
 void endPredicate()
          Indicates the closing of a predicate.
 void endXPath()
          Indicates the closing of an xpath expression.
 Document getDocument()
          Returns the dom document.
 void locationStep(String step)
          Indicates that a location step was found.
 void predicate(PredicateExpr predicate)
          Indicates a predicate in the location path.
 void startLocationPath()
          Indicates the beginning of a LocationPath in an expression.
 void startPredicate()
          Indicates the beginning of a predicate in an expression.
 void startXPath()
          Indicates the beginning of an xpath expression.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NodeCreator

public NodeCreator()
Uses a new DOM document.

NodeCreator

public NodeCreator(Document doc)
Method Detail

startXPath

public void startXPath()
Description copied from interface: LocationPathHandler
Indicates the beginning of an xpath expression. Typically called before any other events are called.
Specified by:
startXPath in interface LocationPathHandler

endXPath

public void endXPath()
Description copied from interface: LocationPathHandler
Indicates the closing of an xpath expression. Typically called at the end of an expression processing.
Specified by:
endXPath in interface LocationPathHandler

startPredicate

public void startPredicate()
Description copied from interface: LocationPathHandler
Indicates the beginning of a predicate in an expression.
Specified by:
startPredicate in interface LocationPathHandler

endPredicate

public void endPredicate()
Description copied from interface: LocationPathHandler
Indicates the closing of a predicate.
Specified by:
endPredicate in interface LocationPathHandler

attributeInPredicate

public void attributeInPredicate(String attrName)
Description copied from interface: LocationPathHandler
Indicates that an attribute was found with in the predicate
Specified by:
attributeInPredicate in interface LocationPathHandler

startLocationPath

public void startLocationPath()
Description copied from interface: LocationPathHandler
Indicates the beginning of a LocationPath in an expression.
Specified by:
startLocationPath in interface LocationPathHandler

endLocationPath

public void endLocationPath()
Description copied from interface: LocationPathHandler
Indicates the closing of a LocationPath.
Specified by:
endLocationPath in interface LocationPathHandler

locationStep

public void locationStep(String step)
Description copied from interface: LocationPathHandler
Indicates that a location step was found.
Specified by:
locationStep in interface LocationPathHandler
Following copied from interface: org.translet.processor.LocationPathHandler
Parameters:
step - the name of the location step.

axes

public void axes(short axescode)
Description copied from interface: LocationPathHandler
Indicates that an axes was encountered.
Specified by:
axes in interface LocationPathHandler
Following copied from interface: org.translet.processor.LocationPathHandler
Parameters:
axesname - the name of the axis.

predicate

public void predicate(PredicateExpr predicate)
Description copied from interface: LocationPathHandler
Indicates a predicate in the location path.
Specified by:
predicate in interface LocationPathHandler
Following copied from interface: org.translet.processor.LocationPathHandler
Parameters:
PredicateExpr - encapsulates the elements of the predicate.

attribute

public void attribute(String attrName)
Description copied from interface: LocationPathHandler
Indicates an attribute in the location path.
Specified by:
attribute in interface LocationPathHandler
Following copied from interface: org.translet.processor.LocationPathHandler
Parameters:
name - of the attribute.

data

public void data(String value)
Description copied from interface: LocationPathHandler
Sets the data.
Specified by:
data in interface LocationPathHandler

createNode

public Node createNode(String nodeName,
                       String namespaceURI,
                       short nodeType)
Description copied from interface: LocationPathHandler
Creates a node of the specified type.
Specified by:
createNode in interface LocationPathHandler
Following copied from interface: org.translet.processor.LocationPathHandler
Parameters:
nodeName - - name for the node. Ignored if not appropriate (like in text nodes).
namespaceURI - - namespace for the node. If invalid then, a no-namespace node will be created.
name - nodeType - a node type as specified in the org.w3c.dom.Node interface.
Returns:
node of the specified type.
Throws:
IllegalArgumentException - if the nodeType is doesn't correspond to the values in the Node interface.

getDocument

public Document getDocument()
Description copied from interface: LocationPathHandler
Returns the dom document.
Specified by:
getDocument in interface LocationPathHandler