com.infoengine.xml
Class XMLtemplate2HTML

java.lang.Object
  extended bycom.infoengine.xml.XMLtemplate2HTML
All Implemented Interfaces:
DocumentHandler, DTDHandler, ErrorHandler, I_handleXML

public class XMLtemplate2HTML
extends Object
implements I_handleXML

Event handler class for converting I*E 2.x XML templates into I*E 2.x HTML templates.

This handler will convert the XML webject tags into appropriate HTML-based equivalents, allowing the SA I*E 2.x server to remain ignorant of XML.

See Also:
EntityResolver, DTDHandler, DocumentHandler, ErrorHandler

Field Summary
(package private)  boolean DEBUG
           
(package private) static int DEFAULT_BUFFER_SIZE
           
(package private)  boolean DTD_DEBUG
           
(package private)  int foundErrorLevel
           
(package private)  int myState
           
(package private) static int NONWEBJECT
           
(package private) static int PARAMETER
           
(package private)  StringBuffer returnData
           
(package private) static int WEBJECT
           
 
Fields inherited from interface com.infoengine.xml.I_handleXML
PARSE_CRITICAL_ERROR, PARSE_OK, PARSE_RECOVERABLE_ERROR, PARSE_WARNING
 
Constructor Summary
XMLtemplate2HTML()
           
 
Method Summary
 void characters(char[] ch, int start, int length)
          This method is called for data imbedded between tags; we'll use it for catching some of the template parameters.
private static void display(char[] ch, int start, int length)
          Display text, escaping some characters.
 void endDocument()
          This method will be called when the SAX parser has completed it's parsing of the passed XML document.
 void endElement(String name)
          This method will be called for the end of each XML element encountered; for XML->HTML Template conversion, this is used to handle the tagging.
 void error(SAXParseException exception)
          Report all recoverable errors, and try to continue parsing.
 void fatalError(SAXParseException exception)
          Report all fatal errors, and try to continue parsing.
 int getErrorLevel()
           
 String getOutput()
           
 void ignorableWhitespace(char[] ch, int start, int length)
          Not used by I*E.
 void notationDecl(String name, String publicId, String systemId)
          Display notation declarations as they are reported.
 void processingInstruction(String target, String data)
          Print a message for a processing instruction.
 void setDocumentLocator(Locator locator)
          Print a message when the parser provides a locator.
 void startDocument()
          This method will be called when the SAX parser has begun parsing the document; this would be good time to open an output stream and other setup tasks.
 void startElement(String name, AttributeList attributes)
          This method is called for the start of each XML element encountered; we need to check said element against a list of possible conversion choices, and then write to the output stream said conversion.
 void unparsedEntityDecl(String name, String publicId, String systemId, String notationName)
          Display unparsed entity declarations as they are reported.
 void warning(SAXParseException exception)
          Report all warnings, and continue parsing.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DTD_DEBUG

boolean DTD_DEBUG

DEBUG

boolean DEBUG

DEFAULT_BUFFER_SIZE

static final int DEFAULT_BUFFER_SIZE
See Also:
Constant Field Values

NONWEBJECT

static final int NONWEBJECT
See Also:
Constant Field Values

WEBJECT

static final int WEBJECT
See Also:
Constant Field Values

PARAMETER

static final int PARAMETER
See Also:
Constant Field Values

myState

int myState

returnData

StringBuffer returnData

foundErrorLevel

int foundErrorLevel
Constructor Detail

XMLtemplate2HTML

public XMLtemplate2HTML()
Method Detail

getOutput

public String getOutput()
Specified by:
getOutput in interface I_handleXML

getErrorLevel

public int getErrorLevel()
Specified by:
getErrorLevel in interface I_handleXML

notationDecl

public void notationDecl(String name,
                         String publicId,
                         String systemId)
Display notation declarations as they are reported.

Specified by:
notationDecl in interface DTDHandler
See Also:
DTDHandler.notationDecl(java.lang.String, java.lang.String, java.lang.String)

unparsedEntityDecl

public void unparsedEntityDecl(String name,
                               String publicId,
                               String systemId,
                               String notationName)
Display unparsed entity declarations as they are reported.

Specified by:
unparsedEntityDecl in interface DTDHandler
See Also:
DTDHandler.unparsedEntityDecl(java.lang.String, java.lang.String, java.lang.String, java.lang.String)

setDocumentLocator

public void setDocumentLocator(Locator locator)
Print a message when the parser provides a locator.

Not all SAX parsers will provide a locator object.

Specified by:
setDocumentLocator in interface DocumentHandler
See Also:
DocumentHandler.setDocumentLocator(org.xml.sax.Locator)

startDocument

public void startDocument()
This method will be called when the SAX parser has begun parsing the document; this would be good time to open an output stream and other setup tasks.

Specified by:
startDocument in interface DocumentHandler
See Also:
DocumentHandler.startDocument()

endDocument

public void endDocument()
This method will be called when the SAX parser has completed it's parsing of the passed XML document. When this method is called, we can finish rendering of the HTML template.

Specified by:
endDocument in interface DocumentHandler
See Also:
DocumentHandler.endDocument()

startElement

public void startElement(String name,
                         AttributeList attributes)

This method is called for the start of each XML element encountered; we need to check said element against a list of possible conversion choices, and then write to the output stream said conversion. A rather pedestrian bit of String processing code. *shrug* It's a living...

Specified by:
startElement in interface DocumentHandler
See Also:
DocumentHandler.startElement(java.lang.String, org.xml.sax.AttributeList)

endElement

public void endElement(String name)

This method will be called for the end of each XML element encountered; for XML->HTML Template conversion, this is used to handle the tagging.

Specified by:
endElement in interface DocumentHandler
See Also:
DocumentHandler.endElement(java.lang.String)

characters

public void characters(char[] ch,
                       int start,
                       int length)

This method is called for data imbedded between tags; we'll use it for catching some of the template parameters.

Specified by:
characters in interface DocumentHandler
See Also:
DocumentHandler.characters(char[], int, int)

ignorableWhitespace

public void ignorableWhitespace(char[] ch,
                                int start,
                                int length)

Not used by I*E.

Specified by:
ignorableWhitespace in interface DocumentHandler
See Also:
DocumentHandler.ignorableWhitespace(char[], int, int)

processingInstruction

public void processingInstruction(String target,
                                  String data)
Print a message for a processing instruction.

Specified by:
processingInstruction in interface DocumentHandler
See Also:
DocumentHandler.processingInstruction(java.lang.String, java.lang.String)

warning

public void warning(SAXParseException exception)
Report all warnings, and continue parsing.

Specified by:
warning in interface ErrorHandler
See Also:
ErrorHandler.warning(org.xml.sax.SAXParseException)

error

public void error(SAXParseException exception)
Report all recoverable errors, and try to continue parsing.

Specified by:
error in interface ErrorHandler
See Also:
ErrorHandler.error(org.xml.sax.SAXParseException)

fatalError

public void fatalError(SAXParseException exception)
Report all fatal errors, and try to continue parsing.

Note: results are no longer reliable once a fatal error has been reported.

Specified by:
fatalError in interface ErrorHandler
See Also:
ErrorHandler.fatalError(org.xml.sax.SAXParseException)

display

private static void display(char[] ch,
                            int start,
                            int length)
Display text, escaping some characters.