org.planx.xmlstore
Class NodeFactory

java.lang.Object
  extended by org.planx.xmlstore.NodeFactory
Direct Known Subclasses:
DVMNodeFactory

public abstract class NodeFactory
extends Object

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

Method Summary
abstract  Attribute createAttribute(String name, String value)
           
abstract  Node createBinaryNode(byte[] data)
           
abstract  Node createCharDataNode(String data)
           
abstract  Node createElementNode(String tagName)
           
abstract  Node createElementNode(String tagName, List<? extends Node> children)
           
abstract  Node createElementNode(String tagName, List<? extends Node> children, List<Attribute> attrs)
           
abstract  Node createElementNode(String tagName, Node... children)
           
abstract  Node createElementNode(String tagName, Node[] children, Attribute[] attrs)
           
abstract
<R extends Reference>
Node
createProxy(XMLStore<R> xmlstore, R ref)
          Use this to convert a reference to a node without loading data.
abstract  Node insertChild(Node n, int index, Node child)
          The method is used for adding a child to an element node.
static NodeFactory instance()
           
abstract  Node removeChild(Node n, int index)
          The method is used for removing a child from an element node.
abstract  Node replaceChild(Node node, int index, Node child)
          The method is used for replacing a child of an element node.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

instance

public static NodeFactory instance()

createAttribute

public abstract Attribute createAttribute(String name,
                                          String value)

createElementNode

public abstract Node createElementNode(String tagName)

createElementNode

public abstract Node createElementNode(String tagName,
                                       List<? extends Node> children)

createElementNode

public abstract Node createElementNode(String tagName,
                                       List<? extends Node> children,
                                       List<Attribute> attrs)

createElementNode

public abstract Node createElementNode(String tagName,
                                       Node... children)

createElementNode

public abstract Node createElementNode(String tagName,
                                       Node[] children,
                                       Attribute[] attrs)

createCharDataNode

public abstract Node createCharDataNode(String data)

createBinaryNode

public abstract Node createBinaryNode(byte[] data)

createProxy

public abstract <R extends Reference> Node createProxy(XMLStore<R> xmlstore,
                                                       R ref)
Use this to convert a reference to a node without loading data. This is useful during saving of large documents. First, save a portion of the data in XMLStore. Second, create a proxy node to the data using this method. This will allow XMLStore to save the data to disk and flush nodes from memory. Make sure you do not yourself hold any pointers to the data saved through any other means than the proxy node created by this method.


replaceChild

public abstract Node replaceChild(Node node,
                                  int index,
                                  Node child)
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.

Parameters:
node - element node.
index - index of the child to replace.
child - new child node.
Returns:
new element node.

insertChild

public abstract Node insertChild(Node n,
                                 int index,
                                 Node child)
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.

Parameters:
n - element node.
index - index at which new child is inserted.
child - new child node.
Returns:
new element node.

removeChild

public abstract Node removeChild(Node n,
                                 int index)
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.

Parameters:
n - element node.
index - index specifying the child to remove
Returns:
new element node.


Copyright © 2004-2005 Plan-X. All Rights Reserved.