Venice 0.751beta

nz.org.venice.prefs.settings
Class XMLHelper

java.lang.Object
  extended bynz.org.venice.prefs.settings.XMLHelper

public class XMLHelper
extends java.lang.Object

This class is for Java version 1.4 which doesn't have support for XPATH


Method Summary
static java.lang.String getAttribute(org.w3c.dom.Element e, java.lang.String attrib)
          Return a string value of the attribute of the element, if it exists.
static java.util.Vector getChildrenByTagName(org.w3c.dom.Node n, java.lang.String tagName)
          Return a List of Nodes which are direct descendents of the node n.
static java.lang.String getValue(org.w3c.dom.Element e, java.lang.String xpath)
          Return a string value of the node defined by xpath.
static java.util.Vector nodeToStringList(java.util.Vector list)
          Convert a list whose elements are Node elements to String elements
static java.util.Vector readList(org.w3c.dom.Element e, java.lang.String listName, java.lang.String entryName)
          Return a Vector of Nodes in a list.
static java.util.Vector readList(org.w3c.dom.Element e, java.lang.String listName, java.lang.String typeString, java.lang.String entryName)
          Return a Vector of Nodes in a list.
static boolean singleton(org.w3c.dom.NodeList list)
           
static java.util.Vector stringToSymbolsList(java.util.List list)
          Convert a list whose elements consist of strings representing symbols to elements representing Venice Symbols
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getValue

public static java.lang.String getValue(org.w3c.dom.Element e,
                                        java.lang.String xpath)
Return a string value of the node defined by xpath.

Parameters:
e - An element of the document
xpath - A string representing a simplified xpath expression It handles neither axes nor predicates. If the last element in the path is not a leaf node, it returns the first element in the list.

getAttribute

public static java.lang.String getAttribute(org.w3c.dom.Element e,
                                            java.lang.String attrib)
Return a string value of the attribute of the element, if it exists. Otherwise, an empty string is returned.

Parameters:
e - A document element
attrib - The attribute name of the element

readList

public static java.util.Vector readList(org.w3c.dom.Element e,
                                        java.lang.String listName,
                                        java.lang.String typeString,
                                        java.lang.String entryName)
Return a Vector of Nodes in a list.

Parameters:
listName - The tag name of the head of the list.
typeString - The attribute defining the type of the list.
entryName - The tag name of the entries of the list. Note that it is not a precondition of this method that e be the head of the list.

readList

public static java.util.Vector readList(org.w3c.dom.Element e,
                                        java.lang.String listName,
                                        java.lang.String entryName)
Return a Vector of Nodes in a list.

Parameters:
listName - The tag name of the head of the list.
entryName - The tag name of the entries of the list. Note that it is not a precondition of this method that e be the head of the list.

singleton

public static boolean singleton(org.w3c.dom.NodeList list)

getChildrenByTagName

public static java.util.Vector getChildrenByTagName(org.w3c.dom.Node n,
                                                    java.lang.String tagName)
Return a List of Nodes which are direct descendents of the node n. This method exists because the standard Java method getElementsByTagName does a n/descendant::tagName rather than than n/tagName.


nodeToStringList

public static java.util.Vector nodeToStringList(java.util.Vector list)
Convert a list whose elements are Node elements to String elements

Parameters:
list - A Vector
Returns:
A Vector

stringToSymbolsList

public static java.util.Vector stringToSymbolsList(java.util.List list)
Convert a list whose elements consist of strings representing symbols to elements representing Venice Symbols

Parameters:
list - A list of string elements
Returns:
A list of Symbol elements

Venice 0.751beta