com.dyuproject.util.xml
Interface Node

All Known Implementing Classes:
SimpleNode

public interface Node

An xml node for persistence - much like DOM.

Author:
David Yu
Date created:
Sep 18, 2008

Method Summary
 void addNode(Node node)
          Adds a child node.
 void addText(char[] data, int start, int length)
          Adds text content as char array.
 void addText(String text)
          Adds text content as String.
 void addText(StringBuffer text)
          Adds text content as StringBuffer.
 void addText(StringBuilder text)
          Adds text content as StringBuilder.
 String getAttribute(String name)
          Gets an attribute mapped with the given name.
 Node getFirstNode()
          Gets the first child node.
 Node getLastNode()
          Gets the last child node.
 String getName()
          Gets the name.
 String getNamespace()
          Gets the namespace.
 Node getNode(int index)
          Gets a child node from the given index.
 Node getNode(String name)
          Gets the first child node with the given name.
 Node getNode(String name, int startingIndex)
          Gets the first child node with the given name, starting at startingIndex.
 Node getNodeFromLast(String name)
          Gets the first child node with the given name, starting from the last.
 Node getNodeFromLast(String name, int startingIndex)
          Gets the first child node with the given name, starting from the last with the specified startingIndex.
 List<Node> getNodes()
          Gets the list of child nodes.
 List<Node> getNodes(String name)
          Gets the list of child nodes with the given name (filtered).
 Node getParent()
          Gets the parent.
 StringBuilder getText()
          Gets the text content as StringBuilder.
 boolean hasAttribute(String name)
          Checks whether the attribute name is present.
 int indexOf(String name)
          Gets the index of the child node with the given name.
 int indexOf(String name, int startingIndex)
          Gets the index of the child node with the given name, starting at startingIndex.
 boolean isRoot()
          Checks whether this node is root.
 int lastIndexOf(String name)
          Gets the index of the child node with the given name, starting from the last.
 int lastIndexOf(String name, int startingIndex)
          Gets the index of the child node with the given name, starting from last with the specified startingIndex.
 String removeAttribute(String name)
          Removes an attribute mapped with the given name.
 Node removeNode(int index)
          Removes a child node from the given index.
 boolean removeNode(Node node)
          Removes a child node.
 void setAttribute(String name, String value)
          Sets an attribute with the given name and value.
 void setName(String name)
          Sets the name.
 void setNamespace(String namespace)
          Sets the namespace.
 void setParent(Node parent)
          Sets the parent.
 int size()
          Gets the number of child elements of this node.
 

Method Detail

setParent

void setParent(Node parent)
Sets the parent.


getParent

Node getParent()
Gets the parent.


isRoot

boolean isRoot()
Checks whether this node is root.


size

int size()
Gets the number of child elements of this node.


setName

void setName(String name)
Sets the name.


getName

String getName()
Gets the name.


setNamespace

void setNamespace(String namespace)
Sets the namespace.


getNamespace

String getNamespace()
Gets the namespace.


addText

void addText(char[] data,
             int start,
             int length)
Adds text content as char array.


addText

void addText(String text)
Adds text content as String.


addText

void addText(StringBuilder text)
Adds text content as StringBuilder.


addText

void addText(StringBuffer text)
Adds text content as StringBuffer.


getText

StringBuilder getText()
Gets the text content as StringBuilder.


setAttribute

void setAttribute(String name,
                  String value)
Sets an attribute with the given name and value.


hasAttribute

boolean hasAttribute(String name)
Checks whether the attribute name is present.


removeAttribute

String removeAttribute(String name)
Removes an attribute mapped with the given name.


getAttribute

String getAttribute(String name)
Gets an attribute mapped with the given name.


addNode

void addNode(Node node)
Adds a child node.


removeNode

Node removeNode(int index)
Removes a child node from the given index.


removeNode

boolean removeNode(Node node)
Removes a child node.


getNodes

List<Node> getNodes()
Gets the list of child nodes.


getNodes

List<Node> getNodes(String name)
Gets the list of child nodes with the given name (filtered).


getFirstNode

Node getFirstNode()
Gets the first child node.


getLastNode

Node getLastNode()
Gets the last child node.


getNode

Node getNode(int index)
Gets a child node from the given index.


getNode

Node getNode(String name)
Gets the first child node with the given name.


getNode

Node getNode(String name,
             int startingIndex)
Gets the first child node with the given name, starting at startingIndex.


getNodeFromLast

Node getNodeFromLast(String name)
Gets the first child node with the given name, starting from the last.


getNodeFromLast

Node getNodeFromLast(String name,
                     int startingIndex)
Gets the first child node with the given name, starting from the last with the specified startingIndex.


indexOf

int indexOf(String name)
Gets the index of the child node with the given name.


indexOf

int indexOf(String name,
            int startingIndex)
Gets the index of the child node with the given name, starting at startingIndex.


lastIndexOf

int lastIndexOf(String name)
Gets the index of the child node with the given name, starting from the last.


lastIndexOf

int lastIndexOf(String name,
                int startingIndex)
Gets the index of the child node with the given name, starting from last with the specified startingIndex.



Copyright © 2008-2013. All Rights Reserved.