Class GBXParser

java.lang.Object
  |
  +--org.xml.sax.helpers.DefaultHandler
        |
        +--GBXParser

public class GBXParser
extends org.xml.sax.helpers.DefaultHandler

A SAX2 Parser for GBX Format. This program is SAX2 parser for the GBX file format.


Field Summary
(package private)  boolean xcoordinateNext
          Elements.
(package private)  boolean ycoordinateNext
          xcoordinate of current gate.
 
Constructor Summary
GBXParser(CircuitDiagram newCD, GateBuilder newGB)
           
 
Method Summary
 void characters(char[] ch, int start, int length)
          The method that handles characters.
 void endElement(java.lang.String uri, java.lang.String localName, java.lang.String qName)
          This method handles the cleanup for new elements.
 void error(org.xml.sax.SAXParseException ex)
          Handler of non-fatal errors.
 void fatalError(org.xml.sax.SAXParseException ex)
          Handler of fatal errors.
 void ignorableWhitespace(char[] ch, int start, int length)
          The method that handles ignorableWhiteSpace.
 void parse(org.xml.sax.InputSource inSource)
          This method does everything needed to parse a file and returns.
 void parse(java.lang.String uri)
          This method does everything needed to parse a file and returns.
 void print(java.lang.String parserName, org.xml.sax.InputSource inSource, boolean validate)
          This methods intializes our parser and prints any information that should be printed.
 void startDocument()
          The method that gets called at the start of the gbx document.
 void startElement(java.lang.String uri, java.lang.String local, java.lang.String raw, org.xml.sax.Attributes attrs)
          The method that handles new elements.
 void warning(org.xml.sax.SAXParseException ex)
          Handler of warnings.
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
endDocument, endPrefixMapping, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startPrefixMapping, unparsedEntityDecl
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

xcoordinateNext

boolean xcoordinateNext
Elements.

ycoordinateNext

boolean ycoordinateNext
xcoordinate of current gate.
Constructor Detail

GBXParser

public GBXParser(CircuitDiagram newCD,
                 GateBuilder newGB)
Method Detail

parse

public void parse(java.lang.String uri)
           throws CancelException
This method does everything needed to parse a file and returns.
Parameters:
uri - the uri of the file to open.
Throws:
CancelException - if there is an error.

parse

public void parse(org.xml.sax.InputSource inSource)
           throws CancelException
This method does everything needed to parse a file and returns.
Parameters:
uri - the uri of the file to open.
Throws:
CancelException - if there is an error.

print

public void print(java.lang.String parserName,
                  org.xml.sax.InputSource inSource,
                  boolean validate)
           throws CancelException
This methods intializes our parser and prints any information that should be printed. The final version will also call the appropriate workspace and logic space constructors.
Parameters:
parserName - The name of the parser to use.
inSource - The file to open and parse.
validate - whether or not we will be validating today. (Ignored)
Throws:
CancelException - if there is an error.

startDocument

public void startDocument()
The method that gets called at the start of the gbx document. This is where all the pre-parsing initialization happens.
Overrides:
startDocument in class org.xml.sax.helpers.DefaultHandler

startElement

public void startElement(java.lang.String uri,
                         java.lang.String local,
                         java.lang.String raw,
                         org.xml.sax.Attributes attrs)
The method that handles new elements.
Overrides:
startElement in class org.xml.sax.helpers.DefaultHandler
Parameters:
uri - the filename that we're parsing.
attr - Attributes.

endElement

public void endElement(java.lang.String uri,
                       java.lang.String localName,
                       java.lang.String qName)
This method handles the cleanup for new elements.
Overrides:
endElement in class org.xml.sax.helpers.DefaultHandler
Parameters:
uri - the filename that we're parsing.
attr - Atrributes.

characters

public void characters(char[] ch,
                       int start,
                       int length)
The method that handles characters.
Overrides:
characters in class org.xml.sax.helpers.DefaultHandler
Parameters:
ch[] - array of characters.
start - start position in character array.
length - number of characters to use from array.

ignorableWhitespace

public void ignorableWhitespace(char[] ch,
                                int start,
                                int length)
The method that handles ignorableWhiteSpace.
Overrides:
ignorableWhitespace in class org.xml.sax.helpers.DefaultHandler
Parameters:
ch[] - array of characters.
start - start position in the character array.
length - number of characters to use from array.

warning

public void warning(org.xml.sax.SAXParseException ex)
Handler of warnings.
Overrides:
warning in class org.xml.sax.helpers.DefaultHandler
Parameters:
ex - SAX Parser Exception.

error

public void error(org.xml.sax.SAXParseException ex)
Handler of non-fatal errors.
Overrides:
error in class org.xml.sax.helpers.DefaultHandler
Parameters:
ex - SAX Parser Exception.

fatalError

public void fatalError(org.xml.sax.SAXParseException ex)
                throws org.xml.sax.SAXException
Handler of fatal errors.
Overrides:
fatalError in class org.xml.sax.helpers.DefaultHandler
Parameters:
ex - Sax Parser Exception.
Throws:
org.xml.sax.SAXException -