condor.classad
Class ClassAdSAXHandler

Object
  extended byorg.xml.sax.helpers.DefaultHandler
      extended bycondor.classad.ClassAdSAXHandler
All Implemented Interfaces:
ContentHandler, DTDHandler, EntityResolver, ErrorHandler

class ClassAdSAXHandler
extends DefaultHandler

A handler for SAX (Simple API for XML) events from a SAXParser. It uses those events to build up an Expr object. Note that this class is not public; it may only be referenced within the condor.classad package. It should only be referenced by ClassAdParser.

Version:
2.2
Author:
Marvin Solomon
See Also:
ClassAdParser

Field Summary
(package private)  Locator locator
          Handle on the original document for reporting the locations of errors.
 
Constructor Summary
(package private) ClassAdSAXHandler()
           
 
Method Summary
 void characters(char[] ch, int start, int length)
          Called by SAXParser after recognizing some "PCDATA" (parsed character data).
 void endElement(String uri, String localName, String name)
          Called by the SAXParser after parsing the end tag of an element.
 void error(SAXParseException e)
          Called by SAXParser if it discovers a (non-fatal) error.
 Expr getResult()
          Get and remove the result of the most recent parse, if any.
(package private)  void printMessage(String msg)
          Print a message, decorated with the current line and column number.
 void setDocumentLocator(Locator locator)
          Called by SAXParser to deliver a locator.
(package private)  void setVerbosity(int level, PrintStream dest)
          Sets the verbosity and error output stream.
 void startElement(String uri, String localName, String name, Attributes attrs)
          Called by SAXParser at the start of an element after parsing the start tag.
 void warning(SAXParseException e)
          Called by SAXParser to announce warnings.
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
endDocument, endPrefixMapping, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

locator

Locator locator
Handle on the original document for reporting the locations of errors.

Constructor Detail

ClassAdSAXHandler

ClassAdSAXHandler()
Method Detail

getResult

public Expr getResult()
Get and remove the result of the most recent parse, if any.

Returns:
the resulting Expr, or null.

setDocumentLocator

public void setDocumentLocator(Locator locator)
Called by SAXParser to deliver a locator.

Parameters:
locator - An object that can return the location of any SAX document event.

warning

public void warning(SAXParseException e)
Called by SAXParser to announce warnings.

Parameters:
e - The warning information encoded as an exception.

error

public void error(SAXParseException e)
Called by SAXParser if it discovers a (non-fatal) error.


characters

public void characters(char[] ch,
                       int start,
                       int length)
Called by SAXParser after recognizing some "PCDATA" (parsed character data). Simply appends the characters to pcdata.

Parameters:
ch - The characters.
start - The start position in the character array.
length - The number of characters to use from the character array.

startElement

public void startElement(String uri,
                         String localName,
                         String name,
                         Attributes attrs)
                  throws SAXException
Called by SAXParser at the start of an element after parsing the start tag.

Parameters:
uri - currenly not documented; appears always to be ''.
localName - The local name (without prefix), or the empty string if Namespace processing is not being performed. Currently ignored.
name - The qualified name (with prefix), or the empty string if qualified names are not available.
attrs - The specified or defaulted attributes. For classad.dtd, there is at most one attribute per tag.
Throws:
SAXException - if something goes wrong.

endElement

public void endElement(String uri,
                       String localName,
                       String name)
Called by the SAXParser after parsing the end tag of an element.

Parameters:
uri - currenly not documented; appears always to be ''.
localName - The local name (without prefix), or the empty string if Namespace processing is not being performed. Currently ignored.
name - The qualified name (with prefix), or the empty string if qualified names are not available.

printMessage

void printMessage(String msg)
Print a message, decorated with the current line and column number.

Parameters:
msg - the message to print.

setVerbosity

void setVerbosity(int level,
                  PrintStream dest)
Sets the verbosity and error output stream. Should only be called from ClassAdParser. No sanity checking is done here.

Parameters:
level - the new verbosity.
dest - the new error stream.