context.arch.comm.language
Class SAX_XMLDecoder

java.lang.Object
  extended byorg.xml.sax.HandlerBase
      extended bycontext.arch.comm.language.SAX_XMLDecoder
All Implemented Interfaces:
DecoderInterface, org.xml.sax.DocumentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler

public class SAX_XMLDecoder
extends org.xml.sax.HandlerBase
implements DecoderInterface

This class provides access to the SAX XML parsing code using the specified XML parser class/driver. It implements ParserInterface and extends HandlerBase

See Also:
DecoderInterface, HandlerBase

Field Summary
static java.lang.String AELFRED_SAX_XML_DECODER
          The AElfred SAX XML decoder
static boolean DEBUG
          Debug flag.
static java.lang.String DEFAULT_SAX_XML_DECODER
          The default SAX XML decoder is com.microstar.xml.SAXDriver (AElfred)
static java.lang.String LANGUAGE
          The language for this class is XML
 
Constructor Summary
SAX_XMLDecoder()
          Basic constructor which uses the default XML parser and sets the document handler to this class
 
Method Summary
 void characters(char[] ch, int start, int length)
          Receive notification of non-element and non-attribute characters ignoring whitespace.
 DataObject decodeData(java.io.Reader XMLdata)
          This method decodes the given XML data and returns the result in a DataObject.
 void endDocument()
          Receive notification of the end of the document.
 void endElement(java.lang.String name)
          Receive notification of the end of an element.
 java.lang.String getClassName()
          Returns the name of the parser driver being used for encoding and decoding
 java.lang.String getLanguage()
          Returns the language being used in encoding and decoding
 void startDocument()
          Receive notification of the beginning of the document.
 void startElement(java.lang.String name, org.xml.sax.AttributeList attributes)
          Receive notification of the start of a new element.
 
Methods inherited from class org.xml.sax.HandlerBase
error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEBUG

public static boolean DEBUG
Debug flag. Set to true to see debug messages.


DEFAULT_SAX_XML_DECODER

public static final java.lang.String DEFAULT_SAX_XML_DECODER
The default SAX XML decoder is com.microstar.xml.SAXDriver (AElfred)

See Also:
Constant Field Values

AELFRED_SAX_XML_DECODER

public static final java.lang.String AELFRED_SAX_XML_DECODER
The AElfred SAX XML decoder

See Also:
Constant Field Values

LANGUAGE

public static final java.lang.String LANGUAGE
The language for this class is XML

See Also:
Constant Field Values
Constructor Detail

SAX_XMLDecoder

public SAX_XMLDecoder()
               throws InvalidDecoderException
Basic constructor which uses the default XML parser and sets the document handler to this class

Throws:
InvalidDecoderException - when the given decoder can not be created
See Also:
DEFAULT_SAX_XML_DECODER
Method Detail

decodeData

public DataObject decodeData(java.io.Reader XMLdata)
                      throws DecodeException
This method decodes the given XML data and returns the result in a DataObject. It calls the parser created in the constructor

Specified by:
decodeData in interface DecoderInterface
Parameters:
XMLdata - XML data to be decoded
Returns:
the DataObject containing the results of the decoded XML data
Throws:
DecodeException - when the given XML data can not be decoded
See Also:
Parser.parse(InputSource)

getLanguage

public java.lang.String getLanguage()
Returns the language being used in encoding and decoding

Specified by:
getLanguage in interface DecoderInterface
Returns:
the language being used in encoding and decoding
See Also:
LANGUAGE

getClassName

public java.lang.String getClassName()
Returns the name of the parser driver being used for encoding and decoding

Specified by:
getClassName in interface DecoderInterface
Returns:
the name of the parser driver being used for encoding and decoding

startDocument

public void startDocument()
Receive notification of the beginning of the document. Creates a new DataObject

Specified by:
startDocument in interface org.xml.sax.DocumentHandler
See Also:
DataObject

endDocument

public void endDocument()
Receive notification of the end of the document. Empty method.

Specified by:
endDocument in interface org.xml.sax.DocumentHandler

startElement

public void startElement(java.lang.String name,
                         org.xml.sax.AttributeList attributes)
Receive notification of the start of a new element. Adds attributes to the DataObject

Specified by:
startElement in interface org.xml.sax.DocumentHandler
Parameters:
name - String name of new element
attributes - AttributeList object containing attributes for new element
See Also:
DataObject.addElement(String,Hashtable)

endElement

public void endElement(java.lang.String name)
Receive notification of the end of an element. Closes the DataObject.

Specified by:
endElement in interface org.xml.sax.DocumentHandler
Parameters:
name - String name of ended element
See Also:
DataObject.closeElement(String)

characters

public void characters(char[] ch,
                       int start,
                       int length)
Receive notification of non-element and non-attribute characters ignoring whitespace. Adds the value to the current element

Specified by:
characters in interface org.xml.sax.DocumentHandler
Parameters:
ch - array of characters read in
start - start position in the array
length - number of characters to read in from the array
See Also:
DataObject.addValue(String)