edu.pdx.cs399J.grader
Class XmlGradeBookParser

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

public class XmlGradeBookParser
extends Object

This class creates a GradeBook from the contents of an XML file.


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
XmlGradeBookParser(File file)
          Creates an XmlGradeBookParser that creates a GradeBook from the contents of a File.
XmlGradeBookParser(String fileName)
          Creates an XmlGradeBookParser that creates a GradeBook from a file of a given name.
 
Method Summary
 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)
           
 GradeBook parse()
          Parses the source and from it creates a GradeBook.
 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

XmlGradeBookParser

public XmlGradeBookParser(String fileName)
                   throws FileNotFoundException,
                          IOException
Creates an XmlGradeBookParser that creates a GradeBook from a file of a given name.

Throws:
FileNotFoundException
IOException

XmlGradeBookParser

public XmlGradeBookParser(File file)
                   throws FileNotFoundException,
                          IOException
Creates an XmlGradeBookParser that creates a GradeBook from the contents of a File.

Throws:
FileNotFoundException
IOException
Method Detail

setStudentDir

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


parse

public GradeBook parse()
                throws ParserException
Parses the source and from it creates a GradeBook.

Throws:
ParserException

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.