wyvern.util
Class XMLVisitor

java.lang.Object
  extended bywyvern.util.XMLVisitor

public class XMLVisitor
extends java.lang.Object

An extremely custom kind of Visitor that knows how to traverse the top-level elements of an XML file. Used by the various "registries" in the game.

Version:
1.0, Jan 12, 2004
Author:
Steve Yegge

Nested Class Summary
static interface XMLVisitor.NodeVisitor
          You provide one of these to the visitNodes() method, and it'll call your Visitor back with each top-level node in the XML document.
 
Constructor Summary
XMLVisitor(java.lang.String path)
          Constructs a new XMLVisitor for the specified XML file.
 
Method Summary
 org.jdom.Document getDocument()
          Returns the Document we built (during the constructor).
static void main(java.lang.String[] args)
          Tests it on the spell registry.
 void visitNodes(XMLVisitor.NodeVisitor v)
          Passes each top-level XML node to the passed Visitor.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLVisitor

public XMLVisitor(java.lang.String path)
           throws java.io.IOException,
                  org.jdom.JDOMException
Constructs a new XMLVisitor for the specified XML file.

Parameters:
path - the absolute path to the file to load.
Method Detail

visitNodes

public void visitNodes(XMLVisitor.NodeVisitor v)
Passes each top-level XML node to the passed Visitor.

Parameters:
v - a NodeVisitor to accept the nodes

getDocument

public org.jdom.Document getDocument()
Returns the Document we built (during the constructor).


main

public static void main(java.lang.String[] args)
Tests it on the spell registry.