project.biota.digir
Class StructureParser

java.lang.Object
  extended byorg.xml.sax.helpers.DefaultHandler
      extended byproject.biota.digir.StructureParser
All Implemented Interfaces:
ContentHandler, DTDHandler, EntityResolver, ErrorHandler

public class StructureParser
extends DefaultHandler

StructureParser parses the record schema specified in the structure element of a DiGIR search request. This schema determines which concepts need to be presented in the DiGIR response.

Author:
Kimmy Lin

Constructor Summary
StructureParser(DiGIRRequestParser requestParser)
          Constructs a StructureParser object to parse the record schema of a DiGIR search request.
 
Method Summary
 void characters(char[] ch, int start, int length)
          Does nothing.
 void endDocument()
          Does nothing.
 void endElement(String namespaceURI, String localName, String qName)
          Receives notification of the end of an element.
 void endPrefixMapping(String prefix)
          Receives notification of the end of a Namespace mapping.
 void error(SAXParseException e)
          Receives notification of a recoverable parser error.
 void fatalError(SAXParseException e)
          Reports a fatal XML parsing error.
 void ignorableWhitespace(char[] ch, int start, int length)
          Receives notification of ignorable whitespace in element content.
 void init()
          Initializes the SAX parser.
 void processingInstruction(String instruction, String data)
          Receives notification of a processing instruction.
 void setDocumentLocator(Locator locator)
          Receive a Locator object for document events.
 void skippedEntity(String name)
          Receives notification of a skipped entity.
 void startDocument()
          Does nothing.
 void startElement(String namespaceURI, String localName, String qName, Attributes atts)
          Receives notification of the start of an element.
 void startParsing(InputSource input)
          Starts parsing the record schema.
 void startPrefixMapping(String prefix, String uri)
          Receives notification of the start of a Namespace mapping.
 void warning(SAXParseException e)
          Receives notification of a parser warning.
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
notationDecl, resolveEntity, unparsedEntityDecl
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StructureParser

public StructureParser(DiGIRRequestParser requestParser)
Constructs a StructureParser object to parse the record schema of a DiGIR search request.

Parameters:
requestParser - the DiGIRRequestParser object that is parsing the DiGIR request
Method Detail

init

public void init()
Initializes the SAX parser.


startParsing

public void startParsing(InputSource input)
Starts parsing the record schema.

Throws:
SAXException - any SAX exception, possibly wrapping another exception

startDocument

public void startDocument()
                   throws SAXException
Does nothing.

Throws:
SAXException - any SAX exception, possibly wrapping another exception

endDocument

public void endDocument()
                 throws SAXException
Does nothing.

Throws:
SAXException - any SAX exception, possibly wrapping another exception

setDocumentLocator

public void setDocumentLocator(Locator locator)
Receive a Locator object for document events.

Parameters:
locator - the locator for all SAX document events

characters

public void characters(char[] ch,
                       int start,
                       int length)
                throws SAXException
Does nothing.

Throws:
SAXException - any SAX exception, possibly wrapping another exception

startElement

public void startElement(String namespaceURI,
                         String localName,
                         String qName,
                         Attributes atts)
                  throws SAXException
Receives notification of the start of an element. Captures each record concept and call the DiGIRRequestParser#addRecordConcept method to add the record concept to the DiGIRRequestParser object.

Parameters:
namespaceURI - the Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed
localName - the local name (without prefix), or the empty string if Namespace processing is not being performed
qName - the qualified name (with prefix), or the empty string if qualified names are not available
atts - the attributes attached to the element. If there are no attributes, it shall be an empty Attributes object
Throws:
SAXException - any SAX exception, possibly wrapping another exception
See Also:
DiGIRRequestParser.addRecordConcept(RecordConcept)

endElement

public void endElement(String namespaceURI,
                       String localName,
                       String qName)
                throws SAXException
Receives notification of the end of an element. Captures each record concept and call the DiGIRRequestParser#addRecordConcept method to add the record concept to the DiGIRRequestParser object.

Parameters:
namespaceURI - the Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed
localName - the local name (without prefix), or the empty string if Namespace processing is not being performed
qName - the qualified name (with prefix), or the empty string if qualified names are not available
Throws:
SAXException

ignorableWhitespace

public void ignorableWhitespace(char[] ch,
                                int start,
                                int length)
                         throws SAXException
Receives notification of ignorable whitespace in element content. Does nothing.

Parameters:
ch - the whitespace characters
start - the start position in the character array
length - the number of characters to use from the character array
Throws:
SAXException - any SAX exception, possibly wrapping another exception

startPrefixMapping

public void startPrefixMapping(String prefix,
                               String uri)
                        throws SAXException
Receives notification of the start of a Namespace mapping. Does nothing.

Parameters:
prefix - the Namespace prefix being declared
uri - the Namespace URI mapped to the prefix
Throws:
SAXException - any SAX exception, possibly wrapping another exception

endPrefixMapping

public void endPrefixMapping(String prefix)
                      throws SAXException
Receives notification of the end of a Namespace mapping. Does nothing.

Parameters:
prefix - the Namespace prefix being declared
Throws:
SAXException - any SAX exception, possibly wrapping another exception

processingInstruction

public void processingInstruction(String instruction,
                                  String data)
                           throws SAXException
Receives notification of a processing instruction.

Parameters:
instruction - the processing instruction target
data - the processing instruction data, or null if none is supplied
Throws:
SAXException - any SAX exception, possibly wrapping another exception

skippedEntity

public void skippedEntity(String name)
                   throws SAXException
Receives notification of a skipped entity. Does nothing.

Parameters:
name - the name of the skipped entity
Throws:
SAXException - any SAX exception, possibly wrapping another exception

error

public void error(SAXParseException e)
           throws SAXException
Receives notification of a recoverable parser error.

Parameters:
e - the error information encoded as an SAXParseException
Throws:
SAXException - any SAX exception, possibly wrapping another exception

warning

public void warning(SAXParseException e)
             throws SAXException
Receives notification of a parser warning.

Parameters:
e - the warning information encoded as an SAXParseException
Throws:
SAXException - any SAX exception, possibly wrapping another exception

fatalError

public void fatalError(SAXParseException e)
                throws SAXException
Reports a fatal XML parsing error.

Parameters:
e - the warning information encoded as an SAXParseException
Throws:
SAXException - any SAX exception, possibly wrapping another exception


Copyright © 2004 University of Massachusetts at Boston. All Rights Reserved.