Project 1

cscie259.project1.mf
Class XMLSerializer

java.lang.Object
  extended by cscie259.project1.mf.DefaultHandler
      extended by cscie259.project1.mf.XMLSerializer
All Implemented Interfaces:
ContentHandler, ErrorHandler

public class XMLSerializer
extends DefaultHandler

A ContentHandler for SAX events that serializes (to an output stream) the events back into XML. Essentially, a simplified version of org.apache.xml.serialize.XMLSerializer. You MAY modify this file to provide support for the serialization of attributes.

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

Constructor Summary
XMLSerializer(java.io.BufferedWriter writer, boolean prettyPrint)
          Configures XMLSerializer with given BufferedWriter and for pretty-printedness, if applicable.
 
Method Summary
 void characters(java.lang.String content)
          Prints out character data, pretty-printed if applicable.
 void endDocument()
          Closes the output stream.
 void endElement(java.lang.String name)
          Prints out the end element tag, pretty-printed if applicable, and updates the current level of indentation.
 void startElement(java.lang.String name, Attributes atts)
          Prints out the start element tag, pretty-printed if applicable, and updates the current level of indentation.
 
Methods inherited from class cscie259.project1.mf.DefaultHandler
fatalError, startDocument
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLSerializer

public XMLSerializer(java.io.BufferedWriter writer,
                     boolean prettyPrint)
Configures XMLSerializer with given BufferedWriter and for pretty-printedness, if applicable.

Parameters:
writer - BufferedWriter for serialization
prettyPrint - flag indicating whether to pretty-print
Method Detail

characters

public void characters(java.lang.String content)
Prints out character data, pretty-printed if applicable.

Specified by:
characters in interface ContentHandler
Overrides:
characters in class DefaultHandler
Parameters:
content - character data

endDocument

public void endDocument()
Closes the output stream.

Specified by:
endDocument in interface ContentHandler
Overrides:
endDocument in class DefaultHandler

endElement

public void endElement(java.lang.String name)
Prints out the end element tag, pretty-printed if applicable, and updates the current level of indentation.

Specified by:
endElement in interface ContentHandler
Overrides:
endElement in class DefaultHandler
Parameters:
name - name of element

startElement

public void startElement(java.lang.String name,
                         Attributes atts)
Prints out the start element tag, pretty-printed if applicable, and updates the current level of indentation.

Specified by:
startElement in interface ContentHandler
Overrides:
startElement in class DefaultHandler
Parameters:
name - name of element
atts - element's collection of attributes

Project 1