FreeHEP API
Version current

org.freehep.xml.util
Class XMLNodeTraverser

java.lang.Object
  extended byorg.freehep.xml.util.XMLNodeTraverser

Deprecated. The design of this class is misguided, it is better to use SAX, and SAXTraverser. Will be removed from future FreeHEP releases

public abstract class XMLNodeTraverser
extends Object

Utility class for traversing XML DOM trees. This is an abstract class that has methods which are called as different elements are located in a DOM tree. It is designed to be extended for each nore in a specific DOM tree, with its methods overriden to handle specific elements and attributes of the tree.

Version:
$Id: XMLNodeTraverser.java,v 1.5 2004/01/19 21:24:00 duns Exp $
Author:
Tony Johnson (tonyj@slac.stanford.edu)
Source Code:
XMLNodeTraverser.java

Nested Class Summary
static class XMLNodeTraverser.BadXMLException
          Deprecated. Exception to throw for any kind of problem during the node traversal
 
Constructor Summary
XMLNodeTraverser()
          Deprecated.  
 
Method Summary
 String getAttributeValue(String name)
          Deprecated. Convenience method to get the value of some attribute.
protected  void handleAttributeNode(Attr node, String name, String value)
          Deprecated. Handle an element attribute.
protected  void handleElement(Element node, String name)
          Deprecated. Handle an Element subnode.
protected  void handleElementAttributes(NamedNodeMap nnm)
          Deprecated. Called to handle the attributes associated with the element being traversed.
protected  void handleOtherNode(Node node, String name)
          Deprecated. Handle a node other than an Element or TextNode.
protected  void handleSubNode(Node node, String name)
          Deprecated. Called to handle a subnode of the node being traversed.
protected  void handleTextNode(Text node, String name)
          Deprecated. Handle a text node.
 boolean toBoolean(String value)
          Deprecated. Utility routine to convert a String to a boolean
 double toDouble(String value)
          Deprecated. Utility routine to convert a String to a double
 int toInt(String value)
          Deprecated. Utility routine to convert a String to an int
 void traverse(Node node)
          Deprecated. Traverse a node
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLNodeTraverser

public XMLNodeTraverser()
Deprecated. 
Method Detail

traverse

public void traverse(Node node)
              throws XMLNodeTraverser.BadXMLException
Deprecated. 
Traverse a node

Parameters:
node - The node to traverse
Throws:
XMLNodeTraverser.BadXMLException

handleSubNode

protected void handleSubNode(Node node,
                             String name)
                      throws XMLNodeTraverser.BadXMLException
Deprecated. 
Called to handle a subnode of the node being traversed. The default implementation calls handleElement, handleTextNode or handleOtherNode as appropriate.

Parameters:
node - The subnode being handled
name - The name of the subnode
Throws:
XMLNodeTraverser.BadXMLException

handleElementAttributes

protected void handleElementAttributes(NamedNodeMap nnm)
                                throws XMLNodeTraverser.BadXMLException
Deprecated. 
Called to handle the attributes associated with the element being traversed. The default implementation calls handleAttributeNode for each attribute

Parameters:
nnm - The attrinbutes being handled
Throws:
XMLNodeTraverser.BadXMLException

handleElement

protected void handleElement(Element node,
                             String name)
                      throws XMLNodeTraverser.BadXMLException
Deprecated. 
Handle an Element subnode. The default implementation throws an exception.

Parameters:
node - The element being handled
name - The name of the element
Throws:
XMLNodeTraverser.BadXMLException

handleTextNode

protected void handleTextNode(Text node,
                              String name)
                       throws XMLNodeTraverser.BadXMLException
Deprecated. 
Handle a text node. The default implementation does nothing

Throws:
XMLNodeTraverser.BadXMLException

handleAttributeNode

protected void handleAttributeNode(Attr node,
                                   String name,
                                   String value)
                            throws XMLNodeTraverser.BadXMLException
Deprecated. 
Handle an element attribute. The default implementation throws an exception

Parameters:
node - The attribute being handled
name - The name of the attribute
value - The value of the attribute
Throws:
XMLNodeTraverser.BadXMLException

handleOtherNode

protected void handleOtherNode(Node node,
                               String name)
                        throws XMLNodeTraverser.BadXMLException
Deprecated. 
Handle a node other than an Element or TextNode. The default implementation throws an exception

Parameters:
node - The node being handled
name - The name of the node
Throws:
XMLNodeTraverser.BadXMLException

toInt

public int toInt(String value)
          throws XMLNodeTraverser.BadXMLException
Deprecated. 
Utility routine to convert a String to an int

Throws:
XMLNodeTraverser.BadXMLException

getAttributeValue

public String getAttributeValue(String name)
Deprecated. 
Convenience method to get the value of some attribute. Note, this will always return null if called while the traverse method is not active. Returns null if the attribute does not exist.


toBoolean

public boolean toBoolean(String value)
                  throws XMLNodeTraverser.BadXMLException
Deprecated. 
Utility routine to convert a String to a boolean

Throws:
XMLNodeTraverser.BadXMLException

toDouble

public double toDouble(String value)
                throws XMLNodeTraverser.BadXMLException
Deprecated. 
Utility routine to convert a String to a double

Throws:
XMLNodeTraverser.BadXMLException

FreeHEP API
Version current

Copyright © 2000-2004 FreeHEP, All Rights Reserved.