org.planx.xmlstore.nodes
Class DVMNodeFactory

java.lang.Object
  extended by org.planx.xmlstore.NodeFactory
      extended by org.planx.xmlstore.nodes.DVMNodeFactory

public final class DVMNodeFactory
extends NodeFactory

An implementation of NodeFactory that operates strictly on SystemNodes. The preferred way to obtain a SystemNode from an unknown Node (which may already be a SystemNode) is not to cast it but to use the convert(Node) method provided here.

Author:
Kasper Bøgebjerg, Henning Niss, Thomas Ambus

Constructor Summary
DVMNodeFactory()
           
 
Method Summary
static SystemNode convert(Node n)
          Addition method that converts any Node to a SystemNode.
 Attribute createAttribute(String name, String value)
           
 Node createCharDataNode(String data)
           
 Node createElementNode(String tagName)
           
 Node createElementNode(String tagName, List<? extends Node> children)
           
 Node createElementNode(String tagName, List<? extends Node> children, List<Attribute> attrs)
           
 Node createElementNode(String tagName, Node child)
           
 Node createElementNode(String tagName, Node[] children)
           
 Node createElementNode(String tagName, Node[] children, Attribute[] attrs)
           
 Node insertChild(Node n, int index, Node child)
          The method is used for adding a child to an element node.
 Node removeChild(Node n, int index)
          The method is used for removing a child from an element node.
 Node replaceChild(Node node, int index, Node child)
          The method is used for replacing a child of an element node.
 
Methods inherited from class org.planx.xmlstore.NodeFactory
instance
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DVMNodeFactory

public DVMNodeFactory()
Method Detail

createAttribute

public Attribute createAttribute(String name,
                                 String value)
Specified by:
createAttribute in class NodeFactory

createElementNode

public Node createElementNode(String tagName)
Specified by:
createElementNode in class NodeFactory

createElementNode

public Node createElementNode(String tagName,
                              List<? extends Node> children)
Specified by:
createElementNode in class NodeFactory

createElementNode

public Node createElementNode(String tagName,
                              List<? extends Node> children,
                              List<Attribute> attrs)
Specified by:
createElementNode in class NodeFactory

createElementNode

public Node createElementNode(String tagName,
                              Node[] children)
Specified by:
createElementNode in class NodeFactory

createElementNode

public Node createElementNode(String tagName,
                              Node[] children,
                              Attribute[] attrs)
Specified by:
createElementNode in class NodeFactory

createElementNode

public Node createElementNode(String tagName,
                              Node child)
Specified by:
createElementNode in class NodeFactory

createCharDataNode

public Node createCharDataNode(String data)
Specified by:
createCharDataNode in class NodeFactory

convert

public static SystemNode convert(Node n)
Addition method that converts any Node to a SystemNode. If it is already a SystemNode it will merely be cast.


replaceChild

public Node replaceChild(Node node,
                         int index,
                         Node child)
Description copied from class: NodeFactory
The method is used for replacing a child of an element node. The replacement is done by constructing and returning a new element node, which only differs from the original element node in the replaced child.

Specified by:
replaceChild in class NodeFactory
Parameters:
node - element node.
index - index of the child to replace.
child - new child node.
Returns:
new element node.

insertChild

public Node insertChild(Node n,
                        int index,
                        Node child)
Description copied from class: NodeFactory
The method is used for adding a child to an element node. This is done by constructing and returning a new element node, which only differs from the original element node in the added child.

Specified by:
insertChild in class NodeFactory
Parameters:
n - element node.
index - index at which new child is inserted.
child - new child node.
Returns:
new element node.

removeChild

public Node removeChild(Node n,
                        int index)
Description copied from class: NodeFactory
The method is used for removing a child from an element node. This is done by constructing and returning a new element node, which only differs from the original element node in the removed child.

Specified by:
removeChild in class NodeFactory
Parameters:
n - element node.
index - index specifying the child to remove
Returns:
new element node.


Copyright © 2010. All Rights Reserved.