context.arch.comm.language
Class SAX_XMLDecoder

java.lang.Object
  |
  +--org.xml.sax.HandlerBase
        |
        +--context.arch.comm.language.SAX_XMLDecoder

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 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

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)

AELFRED_SAX_XML_DECODER

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

LANGUAGE

public static final java.lang.String LANGUAGE
The language for this class is XML
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
Overrides:
startDocument in class org.xml.sax.HandlerBase
See Also:
DataObject

endDocument

public void endDocument()
Receive notification of the end of the document. Empty method.
Overrides:
endDocument in class org.xml.sax.HandlerBase

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
Overrides:
startElement in class org.xml.sax.HandlerBase
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.
Overrides:
endElement in class org.xml.sax.HandlerBase
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
Overrides:
characters in class org.xml.sax.HandlerBase
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)