org.eclipse.actf.model.dom.html
Class NodeUtil

java.lang.Object
  extended by org.eclipse.actf.model.dom.html.NodeUtil

public class NodeUtil
extends Object

Utility class to manipulate Node


Constructor Summary
NodeUtil()
           
 
Method Summary
static void add(Node parent, Node node, Node from, Node to)
          Adds node and moves children specified by from and to to it.
static Node commonAncestor(org.w3c.dom.html.HTMLCollection ancestors)
          Find common ancestor Node of targets
static Node commonAncestor(Node anc1, Node anc2)
          Find common ancestor Node of targets
static void remove(Node node)
          Replaces node with its children.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NodeUtil

public NodeUtil()
Method Detail

commonAncestor

public static Node commonAncestor(Node anc1,
                                  Node anc2)
Find common ancestor Node of targets

Parameters:
anc1 - target Node 1
anc2 - target Node 2
Returns:
common ancestor Node or null if not available

remove

public static void remove(Node node)
Replaces node with its children. The following is an example:
      R          R     
    / \        /|\    
   A   B  ->  A E F   
      / \             
     E   F            
                      
      remove B        
 

Parameters:
node - target node.
Throws:
IllegalArgumentException

add

public static void add(Node parent,
                       Node node,
                       Node from,
                       Node to)
Adds node and moves children specified by from and to to it. The following is an example:
      R         R       
     /|\       / \      
    A E F  -> A   B     
                 / \    
                E   F   
                        
     add B ...          
 

Parameters:
parent - target parent node
node - target node
from - beginning of the children moved to node. If null, no child will be moved.
to - end of the children moved to node
Throws:
IllegalArgumentException

commonAncestor

public static Node commonAncestor(org.w3c.dom.html.HTMLCollection ancestors)
Find common ancestor Node of targets

Parameters:
ancestors - list of target Nodes
Returns:
common ancestor Node or null if not available