org.haphazard.XML
Class CharacterParser

java.lang.Object
  extended byorg.xml.sax.helpers.DefaultHandler
      extended byorg.haphazard.XML.CharacterParser
All Implemented Interfaces:
org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler

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

An XML-handler for a character list


Method Summary
 void characters(char[] ch, int start, int length)
          Is called when characters appear inside an element
 void endDocument()
          This method is called when ending a parse
 void endElement(java.lang.String namespaceURI, java.lang.String sName, java.lang.String qName)
          Is called at the end of parsing an element
 void error(org.xml.sax.SAXParseException err)
          The function will be called if an error is encountered during parsing.
 void fatalError(org.xml.sax.SAXParseException err)
          This function is called when an error that is so severe that the parsing cannot continue is encountered.
static CharacterParser getInstance()
          Gets an instance of the global skill parser
 org.xml.sax.InputSource resolveEntity(java.lang.String publicId, java.lang.String systemId)
          Resolves which dtd file to use and creates an inputsource for this.
 void setCharacter(Character character)
          Sets the place to store all loaded information
 void setDocumentLocator(org.xml.sax.Locator loc)
          Sets the document locator.
 void startDocument()
          This method is called when the document is beginning the parse
 void startElement(java.lang.String namespaceURI, java.lang.String lName, java.lang.String qName, org.xml.sax.Attributes attrs)
          Is called at the start of parsing an element
 void warning(org.xml.sax.SAXParseException err)
          The function is called if a minor error is encountered during parsing.
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
endPrefixMapping, ignorableWhitespace, notationDecl, processingInstruction, skippedEntity, startPrefixMapping, unparsedEntityDecl
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static CharacterParser getInstance()
Gets an instance of the global skill parser

Returns:
An instance of the parser

setCharacter

public void setCharacter(Character character)
Sets the place to store all loaded information

Parameters:
character - The character to load into

resolveEntity

public org.xml.sax.InputSource resolveEntity(java.lang.String publicId,
                                             java.lang.String systemId)
                                      throws org.xml.sax.SAXException
Resolves which dtd file to use and creates an inputsource for this.

Parameters:
publicId - The public ID of the XML-file
systemId - The system ID of the XML file
Returns:
The source of input with the dtd file as a verifier.
Throws:
org.xml.sax.SAXException - If anything goes wrong

startDocument

public void startDocument()
                   throws org.xml.sax.SAXException
This method is called when the document is beginning the parse

Throws:
org.xml.sax.SAXException - Here for compatibility issues

startElement

public void startElement(java.lang.String namespaceURI,
                         java.lang.String lName,
                         java.lang.String qName,
                         org.xml.sax.Attributes attrs)
                  throws org.xml.sax.SAXException
Is called at the start of parsing an element

Parameters:
namespaceURI - The URI of the namespace
lName - 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.
attrs - The specified or defaulted attributes.
Throws:
org.xml.sax.SAXException - If anything goes wrong.

characters

public void characters(char[] ch,
                       int start,
                       int length)
Is called when characters appear inside an element

Parameters:
ch - A buffer with characters
start - The offset in the buffer
length - The length of the characters

endElement

public void endElement(java.lang.String namespaceURI,
                       java.lang.String sName,
                       java.lang.String qName)
                throws org.xml.sax.SAXException
Is called at the end of parsing an element

Parameters:
namespaceURI - The URI of the namespace
sName - The standard name (with namespace)
qName - The qualified name (without namespace)
Throws:
org.xml.sax.SAXException - If anything goes wrong.

endDocument

public void endDocument()
                 throws org.xml.sax.SAXException
This method is called when ending a parse

Throws:
org.xml.sax.SAXException - Here for compatability issues

setDocumentLocator

public void setDocumentLocator(org.xml.sax.Locator loc)
Sets the document locator.

Parameters:
loc - The locator (see XML-documentation)

warning

public void warning(org.xml.sax.SAXParseException err)
             throws org.xml.sax.SAXException
The function is called if a minor error is encountered during parsing.

Parameters:
err - The error
Throws:
org.xml.sax.SAXException - If the error couldn't be handled.

error

public void error(org.xml.sax.SAXParseException err)
           throws org.xml.sax.SAXException
The function will be called if an error is encountered during parsing.

Parameters:
err - The error
Throws:
org.xml.sax.SAXException - If the error couldn't be handled.

fatalError

public void fatalError(org.xml.sax.SAXParseException err)
                throws org.xml.sax.SAXException
This function is called when an error that is so severe that the parsing cannot continue is encountered.

Parameters:
err - The error
Throws:
org.xml.sax.SAXException - If the error couldn't be handled.