Project 1

cscie259.project1.mf
Class XMLParser

java.lang.Object
  extended bycscie259.project1.mf.XMLParser

public class XMLParser
extends java.lang.Object

A simplified XML parser. In essence, this class supports a subset of the functionality collectively offered by javax.xml.parsers.SAXParser and javax.xml.parsers.DocumentBuilder. You MAY modify this file.

Version:
6.0
Author:
Computer Science E-259, YOUR NAME GOES HERE

Constructor Summary
XMLParser()
           
 
Method Summary
protected  boolean isEndTag()
          Returns true if the next characters in the stream are the beginning of an element's end tag.
protected  boolean isStartTag()
          Returns true if the next character in the stream is the beginning of an element's start tag.
 void parse(java.lang.String filename, ContentHandler handler)
          Parses the specified file, if possible, passing SAX events to given handler.
protected  void readElement()
          Parses an element and its content.
protected  void readEndTag(java.lang.String checkName)
          Parses an end tag, ensuring its name matches currently opened element's name.
protected  java.lang.String readStartTag()
          Parses a start tag, returning opened element's name.
protected  void readText()
          Parses character data.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLParser

public XMLParser()
Method Detail

isEndTag

protected boolean isEndTag()
Returns true if the next characters in the stream are the beginning of an element's end tag.

Returns:
true iff next characters in the stream are the beginning of an element's end tag

isStartTag

protected boolean isStartTag()
Returns true if the next character in the stream is the beginning of an element's start tag.

Returns:
true iff next character in the stream is the beginning of an element's start tag

parse

public void parse(java.lang.String filename,
                  ContentHandler handler)
Parses the specified file, if possible, passing SAX events to given handler.

Parameters:
filename - name of file whose contents are to be parsed
handler - ContentHandler for SAX events

readElement

protected void readElement()
Parses an element and its content.


readEndTag

protected void readEndTag(java.lang.String checkName)
Parses an end tag, ensuring its name matches currently opened element's name.

Parameters:
checkName - currently opened element's name with which end tag should be compared

readStartTag

protected java.lang.String readStartTag()
Parses a start tag, returning opened element's name.

Returns:
name of element

readText

protected void readText()
Parses character data.


Project 1