edu.pdx.cs399J.grader
Class XmlDumper

java.lang.Object
  extended by edu.pdx.cs399J.grader.XmlDumper
All Implemented Interfaces:
EntityResolver, ErrorHandler

public class XmlDumper
extends Object

This class dumps the contents of a GradeBook to an XML file. By default, the students in the grade book are dumped to XML files in the same directory as the grade book's XML file.

Since:
Fall 2000
Author:
David Whitlock

Field Summary
protected static String publicID
          The Public ID for the Grade Bookd DTD
protected static String systemID
          The System ID for the Grade Book DTD
 
Constructor Summary
XmlDumper(File xmlFile)
          Creates a new XmlDumper that dumps the contents of a grade book to a given file.
XmlDumper(String xmlFileName)
          Creates a new XmlDumper that dumps the contents of a grade book to a file of the given name.
 
Method Summary
 void dump(GradeBook book)
          Dumps the contents of a GradeBook in XML format.
 void error(SAXParseException ex)
           
protected static List<String> extractNotesFrom(Element element)
          Extracts a bunch of notes from an Element
protected static String extractTextFrom(Element element)
          Extracts the text from an Element.
 void fatalError(SAXParseException ex)
           
 InputSource resolveEntity(String publicId, String systemId)
          Attempt to resolve the external entity (such as a DTD) described by the given public and system ID.
 void setStudentDir(File dir)
          Sets the directory in which the XML files for students are generated.
 void warning(SAXParseException ex)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

systemID

protected static final String systemID
The System ID for the Grade Book DTD

See Also:
Constant Field Values

publicID

protected static final String publicID
The Public ID for the Grade Bookd DTD

See Also:
Constant Field Values
Constructor Detail

XmlDumper

public XmlDumper(File xmlFile)
          throws IOException
Creates a new XmlDumper that dumps the contents of a grade book to a given file.

Throws:
IOException

XmlDumper

public XmlDumper(String xmlFileName)
          throws IOException
Creates a new XmlDumper that dumps the contents of a grade book to a file of the given name.

Throws:
IOException
Method Detail

setStudentDir

public void setStudentDir(File dir)
Sets the directory in which the XML files for students are generated.


dump

public void dump(GradeBook book)
          throws IOException
Dumps the contents of a GradeBook in XML format.

Throws:
IOException

resolveEntity

public InputSource resolveEntity(String publicId,
                                 String systemId)
                          throws SAXException,
                                 IOException
Attempt to resolve the external entity (such as a DTD) described by the given public and system ID. The external entity is returned as a InputSource

Specified by:
resolveEntity in interface EntityResolver
Throws:
SAXException
IOException

warning

public void warning(SAXParseException ex)
             throws SAXException
Specified by:
warning in interface ErrorHandler
Throws:
SAXException

error

public void error(SAXParseException ex)
           throws SAXException
Specified by:
error in interface ErrorHandler
Throws:
SAXException

fatalError

public void fatalError(SAXParseException ex)
                throws SAXException
Specified by:
fatalError in interface ErrorHandler
Throws:
SAXException

extractNotesFrom

protected static List<String> extractNotesFrom(Element element)
Extracts a bunch of notes from an Element


extractTextFrom

protected static String extractTextFrom(Element element)
Extracts the text from an Element.



Copyright © 2000-2009 Portland State University. All Rights Reserved.