org.apache.tuscany.sca.cpp.tools.services
Class GenericDomNodeHandler
java.lang.Object
org.apache.tuscany.sca.cpp.tools.services.GenericDomNodeHandler
- All Implemented Interfaces:
- DomNodeHandler
- Direct Known Subclasses:
- ComponentDomNodeHandler, DomHandler, ReferenceDomNodeHandler, ServiceDomNodeHandler
- public class GenericDomNodeHandler
- extends java.lang.Object
- implements DomNodeHandler
Method Summary |
void |
handleChildElements(org.w3c.dom.Node node,
java.lang.String contextPath,
java.util.Map handlers,
java.util.Map parameters)
This method will iterate through the DOM node's children and call the
appropriate handler for each one. |
void |
handleNode(org.w3c.dom.Node node,
java.lang.String contextXPath,
java.util.Map handlers,
java.util.Map parameters)
This method will place the attributes in this node into the parameter
map keyed by the XPath and recursively continue processing for any
sub-elements of the node. |
static void |
mapNodeToHandlerAndHandle(org.w3c.dom.Node node,
java.lang.String contextPath,
java.util.Map handlers,
java.util.Map parameters)
This method will resolve any registered handler for a particular DOM
element and call the handleNode method on it. |
void |
transferAttrsToParameters(org.w3c.dom.Node node,
java.lang.String contextPath,
java.util.Map parameters)
This method parses the DOM attributes into name value pairs in the
parameter map each valued keyed by its XPath. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
GenericDomNodeHandler
public GenericDomNodeHandler()
transferAttrsToParameters
public void transferAttrsToParameters(org.w3c.dom.Node node,
java.lang.String contextPath,
java.util.Map parameters)
- This method parses the DOM attributes into name value pairs in the
parameter map each valued keyed by its XPath.
- Parameters:
node
- the DOM node being processedcontextPath
- the XPath to the DOM node being processedparameters
- a scratchpad map of name value pairs
handleChildElements
public void handleChildElements(org.w3c.dom.Node node,
java.lang.String contextPath,
java.util.Map handlers,
java.util.Map parameters)
- This method will iterate through the DOM node's children and call the
appropriate handler for each one.
- Parameters:
node
- the DOM node being processedcontextPath
- the XPath to the DOM node being processedhandlers
- a map of element name to handler objectsparameters
- a scratchpad map of name value pairs
mapNodeToHandlerAndHandle
public static void mapNodeToHandlerAndHandle(org.w3c.dom.Node node,
java.lang.String contextPath,
java.util.Map handlers,
java.util.Map parameters)
- This method will resolve any registered handler for a particular DOM
element and call the handleNode method on it. If the handlers map has a
mapping from "entity" to an instance of EntityHandler which implements
the DomNodeHandler interface then any node that looks like
Will be passed to the EntityHandler to process.
- Parameters:
node
- the DOM node being processedcontextPath
- the XPath to the DOM node being processedhandlers
- a map of element name to handler objectsparameters
- a scratchpad map of name value pairs
handleNode
public void handleNode(org.w3c.dom.Node node,
java.lang.String contextXPath,
java.util.Map handlers,
java.util.Map parameters)
- This method will place the attributes in this node into the parameter
map keyed by the XPath and recursively continue processing for any
sub-elements of the node.
- Specified by:
handleNode
in interface DomNodeHandler
- Parameters:
node
- The DOM node being consumedcontextXPath
- The XPath to this nodehandlers
- The map from element name to node handlerparameters
- A map of parameters - this is often used by a handler to place
a name-value pair, the name is often an Xpath representation
of the location of the data in the DOM but handlers are free
to use whatever they like - the contextXpath is generated as
an Xpath prefix for those handlers that wish to use it.
Copyright 2005 The Apache Software Foundation and Copyright IBM Corp. 2005 All Rights Reserved