edu.berkeley.cs.db.yfilterplus.xmltree
Class XMLTree

java.lang.Object
  |
  +--org.xml.sax.helpers.DefaultHandler
        |
        +--edu.berkeley.cs.db.yfilterplus.xmltree.XMLTree
All Implemented Interfaces:
org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler

public class XMLTree
extends org.xml.sax.helpers.DefaultHandler


Field Summary
protected  java.util.Stack m_contextPath
           
protected  int m_eventId
           
protected  java.util.Hashtable m_eventIndex
           
protected  java.util.ArrayList m_eventSequence
           
protected  boolean m_indexing
           
protected  java.io.PrintStream m_out
           
protected  boolean m_trace
           
 
Constructor Summary
XMLTree(java.util.Stack contextPath)
           
XMLTree(java.lang.String filename)
           
XMLTree(java.lang.String filename, boolean dictionaryEncodingNeeded, java.util.HashMap dictionary)
           
XMLTree(java.io.StringReader in)
           
XMLTree(java.io.StringReader in, boolean dictionaryEncodingNeeded, java.util.HashMap dictionary)
           
 
Method Summary
 double analyzeXMLTree(int[] lengthArray, int[] depthArray, int index)
          this function measures(a) the doc length, (b) the maximal depth, and (c) the average path depth for the current xml tree.
 void characters(char[] ch, int start, int count)
          DocumentHandler :: characters:
 void endDocument()
           
 void endElement(java.lang.String uri, java.lang.String local, java.lang.String eleName)
          DocumentHandler :: end element:
 java.util.Hashtable getEventIndex()
           
 java.util.ArrayList getEvents()
           
static void main(java.lang.String[] args)
           
 void print()
           
 void startDocument()
           
 void startElement(java.lang.String uri, java.lang.String local, java.lang.String elementName, org.xml.sax.Attributes attrs)
          DocumentHandler :: start element:
protected  void startParsing(java.lang.String filename)
           
protected  void startParsing(java.io.StringReader in)
           
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startPrefixMapping, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_eventIndex

protected java.util.Hashtable m_eventIndex

m_eventSequence

protected java.util.ArrayList m_eventSequence

m_indexing

protected boolean m_indexing

m_contextPath

protected java.util.Stack m_contextPath

m_eventId

protected int m_eventId

m_trace

protected boolean m_trace

m_out

protected java.io.PrintStream m_out
Constructor Detail

XMLTree

public XMLTree(java.io.StringReader in)

XMLTree

public XMLTree(java.io.StringReader in,
               boolean dictionaryEncodingNeeded,
               java.util.HashMap dictionary)

XMLTree

public XMLTree(java.lang.String filename)

XMLTree

public XMLTree(java.lang.String filename,
               boolean dictionaryEncodingNeeded,
               java.util.HashMap dictionary)

XMLTree

public XMLTree(java.util.Stack contextPath)
Method Detail

startParsing

protected void startParsing(java.io.StringReader in)

startParsing

protected void startParsing(java.lang.String filename)

startDocument

public void startDocument()
Specified by:
startDocument in interface org.xml.sax.ContentHandler
Overrides:
startDocument in class org.xml.sax.helpers.DefaultHandler

startElement

public void startElement(java.lang.String uri,
                         java.lang.String local,
                         java.lang.String elementName,
                         org.xml.sax.Attributes attrs)
DocumentHandler :: start element:

Specified by:
startElement in interface org.xml.sax.ContentHandler
Overrides:
startElement in class org.xml.sax.helpers.DefaultHandler

characters

public void characters(char[] ch,
                       int start,
                       int count)
DocumentHandler :: characters:

Specified by:
characters in interface org.xml.sax.ContentHandler
Overrides:
characters in class org.xml.sax.helpers.DefaultHandler

endElement

public void endElement(java.lang.String uri,
                       java.lang.String local,
                       java.lang.String eleName)
DocumentHandler :: end element:

Specified by:
endElement in interface org.xml.sax.ContentHandler
Overrides:
endElement in class org.xml.sax.helpers.DefaultHandler

endDocument

public void endDocument()
Specified by:
endDocument in interface org.xml.sax.ContentHandler
Overrides:
endDocument in class org.xml.sax.helpers.DefaultHandler

getEvents

public java.util.ArrayList getEvents()

getEventIndex

public java.util.Hashtable getEventIndex()

analyzeXMLTree

public double analyzeXMLTree(int[] lengthArray,
                             int[] depthArray,
                             int index)
this function measures(a) the doc length, (b) the maximal depth, and (c) the average path depth for the current xml tree. it writes (a) to the lengthArray, (b) to the depthArray, at the position specified by the input parameter index, and returns (c).


print

public void print()

main

public static void main(java.lang.String[] args)