edu.UCL.utils
Class Utilities

java.lang.Object
  |
  +--edu.UCL.utils.Utilities

public class Utilities
extends java.lang.Object

This class provides some useful static methods, used in the implementation of XMIDDLE.


Constructor Summary
Utilities()
           
 
Method Summary
static byte[] addArrays(byte[] one, byte[] two)
          Adds two arrays of bytes.
static org.w3c.dom.Document createNewDocument()
          Creates a new DOM Document
static java.lang.String generateXPath(org.w3c.dom.Node n)
          Generates an XPath expression from the root of a tree down to the node passed as a parameter.
static java.lang.String printNode(org.w3c.dom.Node node)
          Prints the given node.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Utilities

public Utilities()
Method Detail

createNewDocument

public static org.w3c.dom.Document createNewDocument()
Creates a new DOM Document

Returns:
An empty DOM Document

generateXPath

public static java.lang.String generateXPath(org.w3c.dom.Node n)
Generates an XPath expression from the root of a tree down to the node passed as a parameter. This method does not produce the prettiest XPath expression ever: Every level in the expression has an index next to it, even if it's not necessary. This should not have a performance impact on the XPath parser so there's no point cleaning it up here.

Parameters:
n - the node to be located with the XPath expression
Returns:
an XPath expression pointing to n

printNode

public static java.lang.String printNode(org.w3c.dom.Node node)
Prints the given node.

Returns:
A String object that contains the XML code corrisponding to the DOM node

addArrays

public static byte[] addArrays(byte[] one,
                               byte[] two)
Adds two arrays of bytes.

Parameters:
one - An array of bytes
two - An array of bytes
Returns:
An array of bytes obtained by the concatenation of the two arguments