SienaXML (v.2.0.0) API documentation

siena.xml
Class DOMTreeProcessing

java.lang.Object
  extended by siena.xml.DOMTreeProcessing

public class DOMTreeProcessing
extends java.lang.Object

This class is used to handle different types of processing of the XML DOM tree generated from the DOMParserWrapper.


Constructor Summary
DOMTreeProcessing()
           
 
Method Summary
static int countSameAttributeValueSiblings(org.w3c.dom.Node node, java.lang.String targetAttr)
          Count the number of siblings that have the same attribute as the node passed in.
static int countSameTagSiblings(org.w3c.dom.Node node)
          This method will return a count of the number of nodes that have the same tag as the node that was passed in.
static int countSiblingsWithTag(org.w3c.dom.Node node, java.lang.String tagName)
          This function will count the number of siblings to the node passed in that have the same tag name as the one contained in the string.
static org.w3c.dom.Node createNode(java.lang.String name, java.lang.String value)
          Create a node with the name name and with the value value
static org.w3c.dom.Node createNode(java.lang.String name, java.lang.String value, java.lang.String namespace)
          Create a node that has the name name, value of value, in the namespace namespace
static org.w3c.dom.Node findChildByName(java.lang.String name, org.w3c.dom.Node node)
          This function will find a child node of the node passed in based on the name given it as an arguement.
static java.lang.String getNodeValue(org.w3c.dom.Node node)
          This method will get the value for the xml tag represented by the node passed in.
static void setValue(org.w3c.dom.Node node, java.lang.String value)
          This sets the value for a node to value
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DOMTreeProcessing

public DOMTreeProcessing()
Method Detail

findChildByName

public static org.w3c.dom.Node findChildByName(java.lang.String name,
                                               org.w3c.dom.Node node)
This function will find a child node of the node passed in based on the name given it as an arguement. If a child node is not found null is returned.

Parameters:
name - The name of the child node to look for
node - The node to use as the parent node.
Returns:
A node that is the child of the node passed in that has the specified name or null if no child could be found.

countSameTagSiblings

public static int countSameTagSiblings(org.w3c.dom.Node node)
This method will return a count of the number of nodes that have the same tag as the node that was passed in.

Parameters:
node - Node to use as the basis of search, both for the tag name and the level in the DOM tree to look at
Returns:
A count of the number of nodes that have the same tag and are siblings of the node that was passed in.

countSiblingsWithTag

public static int countSiblingsWithTag(org.w3c.dom.Node node,
                                       java.lang.String tagName)
This function will count the number of siblings to the node passed in that have the same tag name as the one contained in the string.

Parameters:
node - This is the node used as the reference point for the search.
tagName - This is the name of the tag being looked for
Returns:
The number of siblings that have the "tagName" for their XML tag

getNodeValue

public static java.lang.String getNodeValue(org.w3c.dom.Node node)
This method will get the value for the xml tag represented by the node passed in. If the node has no value but the first child of the node is a text node then the value of the text node is returned.

Parameters:
node - The node to get the value for
Returns:
A string containing the value. If there is no value then null is returned.

countSameAttributeValueSiblings

public static int countSameAttributeValueSiblings(org.w3c.dom.Node node,
                                                  java.lang.String targetAttr)
Count the number of siblings that have the same attribute as the node passed in.

Parameters:
node - The reference Node that determines the attribute value and what nodes to look at (its siblings)
targetAttr - The name of the attribute to look for in the sibling nodes
Returns:
The number of sibling nodes that have the same value for the "targetAttr" attribute.

createNode

public static org.w3c.dom.Node createNode(java.lang.String name,
                                          java.lang.String value)
Create a node with the name name and with the value value

Parameters:
name - The name that the new Node should have
value - The value that the new Node should have
Returns:
The created Node

createNode

public static org.w3c.dom.Node createNode(java.lang.String name,
                                          java.lang.String value,
                                          java.lang.String namespace)
Create a node that has the name name, value of value, in the namespace namespace

Parameters:
name - Name of the new Node
value - Value of the new Node
namespace - Namespace which the node should be in
Returns:
The created Node

setValue

public static void setValue(org.w3c.dom.Node node,
                            java.lang.String value)
This sets the value for a node to value

Parameters:
node - The Node object to change the value of
value - The new value to assign to the Node

SienaXML (v.2.0.0) API documentation

Copyright © 2000-2002 University of Colorado.
This documentation is maintained by Antonio Carzaniga