project.biota.digir
Class ConceptualSchemaParser

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

public class ConceptualSchemaParser
extends DefaultHandler

ConceptualSchemaParser parses the conceptual schema supported by a resource and saves all the defined schema concepts in a java.util.HashSet. Each schema concept is represented by a SchemaConcept object.

Author:
Kimmy Lin
See Also:
SchemaConcept

Constructor Summary
ConceptualSchemaParser(InputSource input)
          Constructs a ConceptualSchemaParser object to parse a conceptual schema for a resource.
 
Method Summary
 void characters(char[] ch, int start, int length)
          Does nothing.
 void endDocument()
          Does nothing.
 void endElement(String namespaceURI, String localName, String qName)
          Does nothing.
 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.
 Set getSchemaConcepts()
          Gets the set of schema concepts read from the conceptual schema.
 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()
          Starts parsing the conceptual 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

ConceptualSchemaParser

public ConceptualSchemaParser(InputSource input)
Constructs a ConceptualSchemaParser object to parse a conceptual schema for a resource.

Parameters:
input - the InputSource object of the conceptual schema
Method Detail

init

public void init()
Initializes the SAX parser.


startParsing

public void startParsing()
                  throws SAXException
Starts parsing the conceptual schema.

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

getSchemaConcepts

public Set getSchemaConcepts()
Gets the set of schema concepts read from the conceptual schema.

Returns:
a java.util.Set of SchemaConcept objects, each representing a schema concept

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 those elements with the name "element" that don't have the abstract attribute set.

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

endElement

public void endElement(String namespaceURI,
                       String localName,
                       String qName)
                throws SAXException
Does nothing.

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. Does nothing.

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.