PAJES 3.0.21

org.pajes.html
Class PajeTemplate

java.lang.Object
  extended by org.pajes.html.PajeTemplate
Direct Known Subclasses:
ListerTemplate, ViewerTemplate

public class PajeTemplate
extends java.lang.Object

Generates an Paje instance from a source HTML file. The source HTML file must be at least XHTML version 1.0 transitional compliant, and therefore, for example, all tags that can have an end tag must have one, including the oft-omitted </p> tag. The use of a utility such as HTMLTidy is recommended.

Sub-classes can perform general tag-specific processing as the template is parsed by over-riding postProcessTag(org.pajes.html.HTML). Post-processing of specific HTML and Input instances is handled by creating methods in the sub-class with the signature:

public HTML postProcessID_<ID= ATTRIBUTE>(HTML html)
to post process tags that have the specified ID attribute.
public HTML postProcessField_<NAME= ATTRIBUTE>(HTML html)
to post process form elements that have the specified NAME attribute.

The template uses reflection to identify to the correct methods to be called. If a method does not exist for a specific ID or NAME attribute, no error is generated.

Document-specific processing by the sub-class is handled by over-riding postProcessDocument(org.pajes.html.Paje).

Any warnings are added to the header section of the resulting document as comments, with a JavaScript alert to warn of their presence.

See Also:
PajeFactory

Constructor Summary
PajeTemplate()
          Creates a PajeTemplate that will generate Paje instances.
PajeTemplate(java.lang.Class<? extends Paje> pajeClass)
          Creates a PajeTemplate that will generate instances of the specified Paje.
PajeTemplate(Paje paje)
          Creates a PajeTemplate that will generate instances of the specified Paje.
 
Method Summary
protected  PajeTemplateWarning addDiscardedUnexpectedTagWarning(java.lang.String[][] attributes)
          Adds a "Discarding unexpected <tag>>" warning message.
protected  void addToContainer(HTML html)
          Adds the specfied HTML object to the current container.
protected  void addToContainer(HTML html, boolean push)
          Adds the specfied HTML object to the current container.
protected  void addToContainer(java.lang.String text)
          Adds the specfied text to the current container as PlainText (ie with no character encoding).
protected  PajeTemplateWarning addWarning(java.lang.String message, java.lang.String[][] attributes)
          Adds a warning message.
protected  void clearWarnings()
          Clears any warnings that were created by the last generate(org.pajes.html.PajeParser).
protected  void dumpAttributes(java.lang.String[][] attributes)
          Internal debugging method to dump the attributes array to System.out.
 Paje generate(PajeParser parser)
          Generates the base Paje instance by processing the parser.
 Paje generate(PajeParser parser, Paje document)
          Generates the base Paje instance by processing the parser.
protected  int getAttributeIndex(java.lang.String[][] attributes, java.lang.String name)
          Returns the index of the specified attribute in an array of attributes.
protected  java.lang.String getAttributeValue(java.lang.String[][] attributes, java.lang.String name)
          Returns the value of the specified attribute in an array of attributes.
protected  Container getCurrentContainer()
          Returns the container to which objects are currently being added.
protected  Form getCurrentForm()
          Returns the current HTML form to which objects are being added.
 PajeTemplateWarning getWarning()
          Returns the first warning set when processing this template.
protected  void handleEmptyTag(java.lang.String[][] attributes)
          Checks for and handles an empty tag.
 void handleTag_a(java.lang.String[][] attributes)
          Handles a tags found in the HTML source file.
 void handleTag_applet(java.lang.String[][] attributes)
          Handles applet tags found in the HTML source file.
 void handleTag_area(java.lang.String[][] attributes)
          Handles area tags found in the HTML source file.
 void handleTag_b(java.lang.String[][] attributes)
          Handles b tags found in the HTML source file.
 void handleTag_base(java.lang.String[][] attributes)
          Handles base tags found in the HTML source file.
 void handleTag_big(java.lang.String[][] attributes)
          Handles big tags found in the HTML source file.
 void handleTag_body(java.lang.String[][] attributes)
          Handles body tags found in the HTML source file.
 void handleTag_br(java.lang.String[][] attributes)
          Handles br tags found in the HTML source file.
 void handleTag_center(java.lang.String[][] attributes)
          Handles center tags found in the HTML source file.
 void handleTag_cite(java.lang.String[][] attributes)
          Handles cite tags found in the HTML source file.
 void handleTag_code(java.lang.String[][] attributes)
          Handles code tags found in the HTML source file.
 void handleTag_col(java.lang.String[][] attributes)
          Handles col tags found in the HTML source file.
 void handleTag_colgroup(java.lang.String[][] attributes)
          Handles colgroup tags found in the HTML source file.
 void handleTag_dd(java.lang.String[][] attributes)
          Handles dd tags found in the HTML source file.
 void handleTag_dfn(java.lang.String[][] attributes)
          Handles dfn tags found in the HTML source file.
 void handleTag_div(java.lang.String[][] attributes)
          Handles div tags found in the HTML source file.
 void handleTag_dl(java.lang.String[][] attributes)
          Handles dl tags found in the HTML source file.
 void handleTag_dt(java.lang.String[][] attributes)
          Handles dt tags found in the HTML source file.
 void handleTag_em(java.lang.String[][] attributes)
          Handles em tags found in the HTML source file.
 void handleTag_embed(java.lang.String[][] attributes)
          Handles embed tags found in the HTML source file.
 void handleTag_fieldset(java.lang.String[][] attributes)
          Handles fieldset tags found in the HTML source file.
 void handleTag_font(java.lang.String[][] attributes)
          Handles font tags found in the HTML source file.
 void handleTag_form(java.lang.String[][] attributes)
          Handles form tags found in the HTML source file.
 void handleTag_frame(java.lang.String[][] attributes)
          Handles frame tags found in the HTML source file.
 void handleTag_frameset(java.lang.String[][] attributes)
          Handles frameset tags found in the HTML source file.
 void handleTag_h1(java.lang.String[][] attributes)
          Handles h1 tags found in the HTML source file.
 void handleTag_h2(java.lang.String[][] attributes)
          Handles h2 tags found in the HTML source file.
 void handleTag_h3(java.lang.String[][] attributes)
          Handles h3 tags found in the HTML source file.
 void handleTag_h4(java.lang.String[][] attributes)
          Handles h4 tags found in the HTML source file.
 void handleTag_h5(java.lang.String[][] attributes)
          Handles h5 tags found in the HTML source file.
 void handleTag_h6(java.lang.String[][] attributes)
          Handles h6 tags found in the HTML source file.
 void handleTag_head(java.lang.String[][] attributes)
          Handles head tags found in the HTML source file.
 void handleTag_hr(java.lang.String[][] attributes)
          Handles hr tags found in the HTML source file.
 void handleTag_html(java.lang.String[][] attributes)
          Handles html tags found in the HTML source file.
 void handleTag_i(java.lang.String[][] attributes)
          Handles i tags found in the HTML source file.
 void handleTag_iframe(java.lang.String[][] attributes)
          Handles iframe tags found in the HTML source file.
 void handleTag_img(java.lang.String[][] attributes)
          Handles img tags found in the HTML source file.
 void handleTag_input_button(java.lang.String[][] attributes)
          Handles input button tags found in the HTML source file.
 void handleTag_input_checkbox(java.lang.String[][] attributes)
          Handles input checkbox tags found in the HTML source file.
 void handleTag_input_file(java.lang.String[][] attributes)
          Handles input file tags found in the HTML source file.
 void handleTag_input_hidden(java.lang.String[][] attributes)
          Handles input hidden tags found in the HTML source file.
 void handleTag_input_image(java.lang.String[][] attributes)
          Handles input image tags found in the HTML source file.
 void handleTag_input_password(java.lang.String[][] attributes)
          Handles input password tags found in the HTML source file.
 void handleTag_input_radio(java.lang.String[][] attributes)
          Handles input radio tags found in the HTML source file.
 void handleTag_input_reset(java.lang.String[][] attributes)
          Handles input reset tags found in the HTML source file.
 void handleTag_input_submit(java.lang.String[][] attributes)
          Handles input submit tags found in the HTML source file.
 void handleTag_input_text(java.lang.String[][] attributes)
          Handles input text tags found in the HTML source file.
 void handleTag_input(java.lang.String[][] attributes)
          Called by handleTag(java.lang.String[][]) to determines and pass to control to the appropriate handleTag_input_XXX method to process the input tag represented by the specified attributes.
 void handleTag_kbd(java.lang.String[][] attributes)
          Handles kbd tags found in the HTML source file.
 void handleTag_label(java.lang.String[][] attributes)
          Handles label tags found in the HTML source file.
 void handleTag_legend(java.lang.String[][] attributes)
          Handles legend tags found in the HTML source file.
 void handleTag_li(java.lang.String[][] attributes)
          Handles li tags found in the HTML source file.
 void handleTag_link(java.lang.String[][] attributes)
          Handles link tags found in the HTML source file.
 void handleTag_map(java.lang.String[][] attributes)
          Handles map tags found in the HTML source file.
 void handleTag_meta(java.lang.String[][] attributes)
          Handles meta tags found in the HTML source file.
 void handleTag_nobr(java.lang.String[][] attributes)
          Handles nobr tags found in the HTML source file.
 void handleTag_noembed(java.lang.String[][] attributes)
          Handles embed tags found in the HTML source file.
 void handleTag_noframes(java.lang.String[][] attributes)
          Handles noframes tags found in the HTML source file.
 void handleTag_noscript(java.lang.String[][] attributes)
          Handles noscript tags found in the HTML source file.
 void handleTag_object(java.lang.String[][] attributes)
          Handles object tags found in the HTML source file.
 void handleTag_ol(java.lang.String[][] attributes)
          Handles ol tags found in the HTML source file.
 void handleTag_optgroup(java.lang.String[][] attributes)
          Handles optgroup tags found in the HTML source file.
 void handleTag_option(java.lang.String[][] attributes)
          Handles option tags found in the HTML source file.
 void handleTag_p(java.lang.String[][] attributes)
          Handles p tags found in the HTML source file.
 void handleTag_param(java.lang.String[][] attributes)
          Handles param tags found in the HTML source file.
 void handleTag_pre(java.lang.String[][] attributes)
          Handles pre tags found in the HTML source file.
 void handleTag_s(java.lang.String[][] attributes)
          Handles s tags found in the HTML source file.
 void handleTag_samp(java.lang.String[][] attributes)
          Handles samp tags found in the HTML source file.
 void handleTag_script(java.lang.String[][] attributes)
          Handles script tags found in the HTML source file.
 void handleTag_select(java.lang.String[][] attributes)
          Handles select tags found in the HTML source file.
 void handleTag_small(java.lang.String[][] attributes)
          Handles small tags found in the HTML source file.
 void handleTag_span(java.lang.String[][] attributes)
          Handles span tags found in the HTML source file.
 void handleTag_strike(java.lang.String[][] attributes)
          Handles strike tags found in the HTML source file.
 void handleTag_strong(java.lang.String[][] attributes)
          Handles strong tags found in the HTML source file.
 void handleTag_style(java.lang.String[][] attributes)
          Handles style tags found in the HTML source file.
 void handleTag_sub(java.lang.String[][] attributes)
          Handles sub tags found in the HTML source file.
 void handleTag_sup(java.lang.String[][] attributes)
          Handles sup tags found in the HTML source file.
 void handleTag_table(java.lang.String[][] attributes)
          Handles table tags found in the HTML source file.
 void handleTag_tbody(java.lang.String[][] attributes)
          Handles tbody tags found in the HTML source file.
 void handleTag_td(java.lang.String[][] attributes)
          Handles td tags found in the HTML source file.
 void handleTag_textarea(java.lang.String[][] attributes)
          Handles textarea tags found in the HTML source file.
 void handleTag_tfoot(java.lang.String[][] attributes)
          Handles tfoot tags found in the HTML source file.
 void handleTag_th(java.lang.String[][] attributes)
          Handles th tags found in the HTML source file.
 void handleTag_thead(java.lang.String[][] attributes)
          Handles thead tags found in the HTML source file.
 void handleTag_title(java.lang.String[][] attributes)
          Handles title tags found in the HTML source file.
 void handleTag_tr(java.lang.String[][] attributes)
          Handles tr tags found in the HTML source file.
 void handleTag_tt(java.lang.String[][] attributes)
          Handles tt tags found in the HTML source file.
 void handleTag_u(java.lang.String[][] attributes)
          Handles u tags found in the HTML source file.
 void handleTag_ul(java.lang.String[][] attributes)
          Handles ul tags found in the HTML source file.
 void handleTag_var(java.lang.String[][] attributes)
          Handles var tags found in the HTML source file.
protected  void handleTag(java.lang.String[][] attributes)
          Determines and passes to control to the appropriate handleTag_XXX method to process the tag represented by the specified attributes.
 java.lang.String handleText(java.lang.String[][] attributes)
          Handles the text between a start and end tag.
 void handleUnclosedFormattedTextTags(java.lang.String[][] attributes)
          Attempts to handle a missing end tag of any FormattedText objects.
 boolean handleUnclosedTag_colgroup(java.lang.String[][] attributes)
          Attempts to handle a missing </colgroup> tag.
 boolean handleUnclosedTag_dd(java.lang.String[][] attributes)
          Attempts to handle a missing </dd> tag.
 boolean handleUnclosedTag_dt(java.lang.String[][] attributes)
          Attempts to handle a missing </dt> tag.
 boolean handleUnclosedTag_li(java.lang.String[][] attributes)
          Attempts to handle a missing </li> tag.
 boolean handleUnclosedTag_option(java.lang.String[][] attributes)
          Attempts to handle a missing </option> tag.
 boolean handleUnclosedTag_p(java.lang.String[][] attributes)
          Attempts to handle a missing </p> tag.
protected  void log(java.lang.String msg)
          Logs a message to the ServletContext, if logging is enabled.
protected  void log(java.lang.String msg, HTML html)
          Logs a message and an HTML object to the ServletContext.
protected  void log(java.lang.String part1, java.lang.String part2)
          Logs a message to the ServletContext.
protected  void log(java.lang.String msg, java.lang.String[][] attributes)
          Logs a message and set of attributes to the ServletContext.
protected  void log(java.lang.String part1, java.lang.String part2, java.lang.String part3)
          Logs a message to the ServletContext.
protected  void log(java.lang.String part1, java.lang.String part2, java.lang.String part3, java.lang.Class<?> part4)
          Logs a message to the ServletContext.
protected  void log(java.lang.Throwable t)
          Logs a stack trace to the ServletContext.
protected static void modifyLineBreaks(Tag tag, boolean before, boolean beforeContent, boolean after, boolean afterContent)
          Convenience method to allow custom modification of tag line breaks.
protected  Container popCurrentContainer()
          Removes the current container from the top of the stack.
protected  Container popCurrentPsuedoContainer(Tag tag, java.lang.String[][] endTagAttributes)
          Removes the current container from the top of the stack and populates the specified tag with the attributes specified on the opening tag.
protected  void postProcessDocument(Paje document)
          Called immediately after all tags have been added to the document.
protected  HTML postProcessTag(HTML tag)
          Called immediately before adding the tag to the document, but after any field or id specific processing.
 void setLogging(javax.servlet.ServletContext context)
          Turns on debug logging.
 PajeTemplate setSuppressWarning(boolean on)
          Allows the suppression of the JavaScript alert warning in the generated document warning of parser errors.
protected  PajeTemplateWarning setWarning(java.lang.String message, java.lang.String[][] attributes)
          Deprecated. Use addWarning(String, String[][]) instead.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PajeTemplate

public PajeTemplate()
Creates a PajeTemplate that will generate Paje instances.


PajeTemplate

public PajeTemplate(java.lang.Class<? extends Paje> pajeClass)
             throws java.lang.IllegalAccessException,
                    java.lang.InstantiationException
Creates a PajeTemplate that will generate instances of the specified Paje.

Parameters:
pajeClass - the Paje sub-class from which new instances will be returned.
Throws:
java.lang.IllegalAccessException - if the specified class is not accessible.
java.lang.InstantiationException - if the specified class is an interface or an abstract class.

PajeTemplate

public PajeTemplate(Paje paje)
Creates a PajeTemplate that will generate instances of the specified Paje.

Parameters:
paje - the Paje from which new instances will be returned.
Method Detail

modifyLineBreaks

protected static void modifyLineBreaks(Tag tag,
                                       boolean before,
                                       boolean beforeContent,
                                       boolean after,
                                       boolean afterContent)
Convenience method to allow custom modification of tag line breaks.

Parameters:
tag - the tag to be modified.
before - true if a line feed should be written before the tag.
beforeContent - true if a line feed should be written before the tag content.
after - true if a line feed should be written after the tag.
afterContent - true if a line feed should be written after the tag content.

generate

public final Paje generate(PajeParser parser)
                    throws java.io.IOException
Generates the base Paje instance by processing the parser.

Parameters:
parser - the parser that will read the source HTML file.
Returns:
the base Paje from which other documents may be cloned.
Throws:
java.io.IOException - if an I/O exception occurs whilst generating the Paje.

generate

public final Paje generate(PajeParser parser,
                           Paje document)
                    throws java.io.IOException
Generates the base Paje instance by processing the parser.

Parameters:
parser - the parser that will read the source HTML file.
document - the base document to which the template contents will be added.
Returns:
the base Paje from which other documents may be cloned.
Throws:
java.io.IOException - if an I/O exception occurs whilst generating the Paje.

getWarning

public PajeTemplateWarning getWarning()
Returns the first warning set when processing this template. Subsequent warnings can be retrieved using the PajeTemplateWarning.getNextWarning() method.

Returns:
the warnings encountered when parsing the source HTML file.

handleTag_a

public void handleTag_a(java.lang.String[][] attributes)
Handles a tags found in the HTML source file.

Parameters:
attributes - the array of attributes from which the tag will be constructed.

handleTag_applet

public void handleTag_applet(java.lang.String[][] attributes)
Handles applet tags found in the HTML source file.

Parameters:
attributes - the array of attributes from which the tag will be constructed.
Throws:
TagException - if an error is encountered constructing the tag.

handleTag_area

public void handleTag_area(java.lang.String[][] attributes)
Handles area tags found in the HTML source file.

Parameters:
attributes - the array of attributes from which the tag will be constructed.

handleTag_b

public void handleTag_b(java.lang.String[][] attributes)
Handles b tags found in the HTML source file.

Parameters:
attributes - the array of attributes from which the tag will be constructed.
Throws:
TagException - if an error is encountered constructing the tag.

handleTag_base

public void handleTag_base(java.lang.String[][] attributes)
Handles base tags found in the HTML source file.

Parameters:
attributes - the array of attributes from which the tag will be constructed.
Throws:
TagException - if an error is encountered constructing the tag.

handleTag_big

public void handleTag_big(java.lang.String[][] attributes)
Handles big tags found in the HTML source file.

Parameters:
attributes - the array of attributes from which the tag will be constructed.
Throws:
TagException - if an error is encountered constructing the tag.

handleTag_body

public void handleTag_body(java.lang.String[][] attributes)
Handles body tags found in the HTML source file.

Parameters:
attributes - the array of attributes from which the tag will be constructed.
Throws:
TagException - if an error is encountered constructing the tag.

handleTag_br

public void handleTag_br(java.lang.String[][] attributes)
Handles br tags found in the HTML source file.

Parameters:
attributes - the array of attributes from which the tag will be constructed.

handleTag_center

public void handleTag_center(java.lang.String[][] attributes)
Handles center tags found in the HTML source file.

Parameters:
attributes - the array of attributes from which the tag will be constructed.

handleTag_cite

public void handleTag_cite(java.lang.String[][] attributes)
Handles cite tags found in the HTML source file.

Parameters:
attributes - the array of attributes from which the tag will be constructed.
Throws:
TagException - if an error is encountered constructing the tag.

handleTag_code

public void handleTag_code(java.lang.String[][] attributes)
Handles code tags found in the HTML source file.

Parameters:
attributes - the array of attributes from which the tag will be constructed.
Throws:
TagException - if an error is encountered constructing the tag.

handleTag_col

public void handleTag_col(java.lang.String[][] attributes)
Handles col tags found in the HTML source file.

Parameters:
attributes - the array of attributes from which the tag will be constructed.
Throws:
TagException - if an error is encountered constructing the tag.

handleTag_colgroup

public void handleTag_colgroup(java.lang.String[][] attributes)
Handles colgroup tags found in the HTML source file.

Parameters:
attributes - the array of attributes from which the tag will be constructed.
Throws:
TagException - if an error is encountered constructing the tag.

handleTag_dd

public void handleTag_dd(java.lang.String[][] attributes)
Handles dd tags found in the HTML source file.

Parameters:
attributes - the array of attributes from which the tag will be constructed.
Throws:
TagException - if an error is encountered constructing the tag.

handleTag_dfn

public void handleTag_dfn(java.lang.String[][] attributes)
Handles dfn tags found in the HTML source file.

Parameters:
attributes - the array of attributes from which the tag will be constructed.
Throws:
TagException - if an error is encountered constructing the tag.

handleTag_div

public void handleTag_div(java.lang.String[][] attributes)
Handles div tags found in the HTML source file.

Parameters:
attributes - the array of attributes from which the tag will be constructed.
Throws:
TagException - if an error is encountered constructing the tag.

handleTag_dl

public void handleTag_dl(java.lang.String[][] attributes)
Handles dl tags found in the HTML source file.

Parameters:
attributes - the array of attributes from which the tag will be constructed.
Throws:
TagException - if an error is encountered constructing the tag.

handleTag_dt

public void handleTag_dt(java.lang.String[][] attributes)
Handles dt tags found in the HTML source file.

Parameters:
attributes - the array of attributes from which the tag will be constructed.
Throws:
TagException - if an error is encountered constructing the tag.

handleTag_em

public void handleTag_em(java.lang.String[][] attributes)
Handles em tags found in the HTML source file.

Parameters:
attributes - the array of attributes from which the tag will be constructed.
Throws:
TagException - if an error is encountered constructing the tag.

handleTag_embed

public void handleTag_embed(java.lang.String[][] attributes)
Handles embed tags found in the HTML source file.

Parameters:
attributes - the array of attributes from which the tag will be constructed.
Throws:
TagException - if an error is encountered constructing the tag.

handleTag_fieldset

public void handleTag_fieldset(java.lang.String[][] attributes)
Handles fieldset tags found in the HTML source file.

Parameters:
attributes - the array of attributes from which the tag will be constructed.
Throws:
TagException - if an error is encountered constructing the tag.

handleTag_font

public void handleTag_font(java.lang.String[][] attributes)
Handles font tags found in the HTML source file.

Parameters:
attributes - the array of attributes from which the tag will be constructed.
Throws:
TagException - if an error is encountered constructing the tag.

handleTag_form

public void handleTag_form(java.lang.String[][] attributes)
Handles form tags found in the HTML source file.

Parameters:
attributes - the array of attributes from which the tag will be constructed.
Throws:
TagException - if an error is encountered constructing the tag.

handleTag_frame

public void handleTag_frame(java.lang.String[][] attributes)
Handles frame tags found in the HTML source file.

Parameters:
attributes - the array of attributes from which the tag will be constructed.
Throws:
TagException - if an error is encountered constructing the tag.

handleTag_frameset

public void handleTag_frameset(java.lang.String[][] attributes)
Handles frameset tags found in the HTML source file.

Parameters:
attributes - the array of attributes from which the tag will be constructed.
Throws:
TagException - if an error is encountered constructing the tag.

handleTag_h1

public void handleTag_h1(java.lang.String[][] attributes)
Handles h1 tags found in the HTML source file.

Parameters:
attributes - the array of attributes from which the tag will be constructed.

handleTag_h2

public void handleTag_h2(java.lang.String[][] attributes)
Handles h2 tags found in the HTML source file.

Parameters:
attributes - the array of attributes from which the tag will be constructed.

handleTag_h3

public void handleTag_h3(java.lang.String[][] attributes)
Handles h3 tags found in the HTML source file.

Parameters:
attributes - the array of attributes from which the tag will be constructed.

handleTag_h4

public void handleTag_h4(java.lang.String[][] attributes)
Handles h4 tags found in the HTML source file.

Parameters:
attributes - the array of attributes from which the tag will be constructed.

handleTag_h5

public void handleTag_h5(java.lang.String[][] attributes)
Handles h5 tags found in the HTML source file.

Parameters:
attributes - the array of attributes from which the tag will be constructed.

handleTag_h6

public void handleTag_h6(java.lang.String[][] attributes)
Handles h6 tags found in the HTML source file.

Parameters:
attributes - the array of attributes from which the tag will be constructed.

handleTag_head

public void handleTag_head(java.lang.String[][] attributes)
Handles head tags found in the HTML source file.

Parameters:
attributes - the array of attributes from which the tag will be constructed.
Throws:
TagException - if an error is encountered constructing the tag.

handleTag_hr

public void handleTag_hr(java.lang.String[][] attributes)
Handles hr tags found in the HTML source file.

Parameters:
attributes - the array of attributes from which the tag will be constructed.

handleTag_html

public void handleTag_html(java.lang.String[][] attributes)
Handles html tags found in the HTML source file.

Parameters:
attributes - the array of attributes from which the tag will be constructed.

handleTag_i

public void handleTag_i(java.lang.String[][] attributes)
Handles i tags found in the HTML source file.

Parameters:
attributes - the array of attributes from which the tag will be constructed.
Throws:
TagException - if an error is encountered constructing the tag.

handleTag_iframe

public void handleTag_iframe(java.lang.String[][] attributes)
Handles iframe tags found in the HTML source file.

Parameters:
attributes - the array of attributes from which the tag will be constructed.
Throws:
TagException - if an error is encountered constructing the tag.

handleTag_img

public void handleTag_img(java.lang.String[][] attributes)
Handles img tags found in the HTML source file.

Parameters:
attributes - the array of attributes from which the tag will be constructed.

handleTag_input

public void handleTag_input(java.lang.String[][] attributes)
                     throws java.lang.IllegalAccessException,
                            java.lang.NoSuchMethodException,
                            java.lang.reflect.InvocationTargetException
Called by handleTag(java.lang.String[][]) to determines and pass to control to the appropriate handleTag_input_XXX method to process the input tag represented by the specified attributes.

Parameters:
attributes - the array of attributes from which the input tag will be constructed.
Throws:
java.lang.IllegalAccessException - if the specified class is not accesible.
java.lang.NoSuchMethodException - if no method exists to handle the input type.
java.lang.reflect.InvocationTargetException - if an exception is thrown creating the tag instance.

handleTag_input_button

public void handleTag_input_button(java.lang.String[][] attributes)
Handles input button tags found in the HTML source file.

Parameters:
attributes - the array of attributes from which the tag will be constructed.

handleTag_input_checkbox

public void handleTag_input_checkbox(java.lang.String[][] attributes)
Handles input checkbox tags found in the HTML source file.

Parameters:
attributes - the array of attributes from which the tag will be constructed.

handleTag_input_file

public void handleTag_input_file(java.lang.String[][] attributes)
Handles input file tags found in the HTML source file.

Parameters:
attributes - the array of attributes from which the tag will be constructed.

handleTag_input_hidden

public void handleTag_input_hidden(java.lang.String[][] attributes)
Handles input hidden tags found in the HTML source file.

Parameters:
attributes - the array of attributes from which the tag will be constructed.

handleTag_input_image

public void handleTag_input_image(java.lang.String[][] attributes)
Handles input image tags found in the HTML source file.

Parameters:
attributes - the array of attributes from which the tag will be constructed.

handleTag_input_password

public void handleTag_input_password(java.lang.String[][] attributes)
Handles input password tags found in the HTML source file.

Parameters:
attributes - the array of attributes from which the tag will be constructed.

handleTag_input_radio

public void handleTag_input_radio(java.lang.String[][] attributes)
Handles input radio tags found in the HTML source file.

Parameters:
attributes - the array of attributes from which the tag will be constructed.

handleTag_input_reset

public void handleTag_input_reset(java.lang.String[][] attributes)
Handles input reset tags found in the HTML source file.

Parameters:
attributes - the array of attributes from which the tag will be constructed.

handleTag_input_submit

public void handleTag_input_submit(java.lang.String[][] attributes)
Handles input submit tags found in the HTML source file.

Parameters:
attributes - the array of attributes from which the tag will be constructed.

handleTag_input_text

public void handleTag_input_text(java.lang.String[][] attributes)
Handles input text tags found in the HTML source file.

Parameters:
attributes - the array of attributes from which the tag will be constructed.

handleTag_kbd

public void handleTag_kbd(java.lang.String[][] attributes)
Handles kbd tags found in the HTML source file.

Parameters:
attributes - the array of attributes from which the tag will be constructed.
Throws:
TagException - if an error is encountered constructing the tag.

handleTag_label

public void handleTag_label(java.lang.String[][] attributes)
Handles label tags found in the HTML source file.

Parameters:
attributes - the array of attributes from which the tag will be constructed.
Throws:
TagException - if an error is encountered constructing the tag.

handleTag_legend

public void handleTag_legend(java.lang.String[][] attributes)
Handles legend tags found in the HTML source file.

Parameters:
attributes - the array of attributes from which the tag will be constructed.

handleTag_li

public void handleTag_li(java.lang.String[][] attributes)
Handles li tags found in the HTML source file.

Parameters:
attributes - the array of attributes from which the tag will be constructed.
Throws:
TagException - if an error is encountered constructing the tag.

handleTag_link

public void handleTag_link(java.lang.String[][] attributes)
Handles link tags found in the HTML source file.

Parameters:
attributes - the array of attributes from which the tag will be constructed.
Throws:
TagException - if an error is encountered constructing the tag.

handleTag_map

public void handleTag_map(java.lang.String[][] attributes)
Handles map tags found in the HTML source file.

Parameters:
attributes - the array of attributes from which the tag will be constructed.
Throws:
TagException - if an error is encountered constructing the tag.

handleTag_meta

public void handleTag_meta(java.lang.String[][] attributes)
Handles meta tags found in the HTML source file.

Parameters:
attributes - the array of attributes from which the tag will be constructed.
Throws:
TagException - if an error is encountered constructing the tag.

handleTag_nobr

public void handleTag_nobr(java.lang.String[][] attributes)
Handles nobr tags found in the HTML source file.

Parameters:
attributes - the array of attributes from which the tag will be constructed.
Throws:
TagException - if an error is encountered constructing the tag.

handleTag_noembed

public void handleTag_noembed(java.lang.String[][] attributes)
Handles embed tags found in the HTML source file.

Parameters:
attributes - the array of attributes from which the tag will be constructed.
Throws:
TagException - if an error is encountered constructing the tag.

handleTag_noframes

public void handleTag_noframes(java.lang.String[][] attributes)
Handles noframes tags found in the HTML source file.

Parameters:
attributes - the array of attributes from which the tag will be constructed.
Throws:
TagException - if an error is encountered constructing the tag.

handleTag_noscript

public void handleTag_noscript(java.lang.String[][] attributes)
Handles noscript tags found in the HTML source file.

Parameters:
attributes - the array of attributes from which the tag will be constructed.
Throws:
TagException - if an error is encountered constructing the tag.

handleTag_object

public void handleTag_object(java.lang.String[][] attributes)
Handles object tags found in the HTML source file.

Parameters:
attributes - the array of attributes from which the tag will be constructed.
Throws:
TagException - if an error is encountered constructing the tag.

handleTag_ol

public void handleTag_ol(java.lang.String[][] attributes)
Handles ol tags found in the HTML source file.

Parameters:
attributes - the array of attributes from which the tag will be constructed.
Throws:
TagException - if an error is encountered constructing the tag.

handleTag_optgroup

public void handleTag_optgroup(java.lang.String[][] attributes)
Handles optgroup tags found in the HTML source file.

Parameters:
attributes - the array of attributes from which the tag will be constructed.
Throws:
TagException - if an error is encountered constructing the tag.

handleTag_option

public void handleTag_option(java.lang.String[][] attributes)
Handles option tags found in the HTML source file.

Parameters:
attributes - the array of attributes from which the tag will be constructed.
Throws:
TagException - if an error is encountered constructing the tag.

handleTag_p

public void handleTag_p(java.lang.String[][] attributes)
Handles p tags found in the HTML source file.

Parameters:
attributes - the array of attributes from which the tag will be constructed.
Throws:
TagException - if an error is encountered constructing the tag.

handleTag_param

public void handleTag_param(java.lang.String[][] attributes)
Handles param tags found in the HTML source file.

Parameters:
attributes - the array of attributes from which the tag will be constructed.

handleTag_pre

public void handleTag_pre(java.lang.String[][] attributes)
Handles pre tags found in the HTML source file.

Parameters:
attributes - the array of attributes from which the tag will be constructed.

handleTag_s

public void handleTag_s(java.lang.String[][] attributes)
Handles s tags found in the HTML source file.

Parameters:
attributes - the array of attributes from which the tag will be constructed.
Throws:
TagException - if an error is encountered constructing the tag.

handleTag_samp

public void handleTag_samp(java.lang.String[][] attributes)
Handles samp tags found in the HTML source file.

Parameters:
attributes - the array of attributes from which the tag will be constructed.
Throws:
TagException - if an error is encountered constructing the tag.

handleTag_script

public void handleTag_script(java.lang.String[][] attributes)
Handles script tags found in the HTML source file.

Parameters:
attributes - the array of attributes from which the tag will be constructed.
Throws:
TagException - if an error is encountered constructing the tag.

handleTag_select

public void handleTag_select(java.lang.String[][] attributes)
Handles select tags found in the HTML source file.

Parameters:
attributes - the array of attributes from which the tag will be constructed.
Throws:
TagException - if an error is encountered constructing the tag.

handleTag_small

public void handleTag_small(java.lang.String[][] attributes)
Handles small tags found in the HTML source file.

Parameters:
attributes - the array of attributes from which the tag will be constructed.
Throws:
TagException - if an error is encountered constructing the tag.

handleTag_span

public void handleTag_span(java.lang.String[][] attributes)
Handles span tags found in the HTML source file.

Parameters:
attributes - the array of attributes from which the tag will be constructed.
Throws:
TagException - if an error is encountered constructing the tag.

handleTag_strike

public void handleTag_strike(java.lang.String[][] attributes)
Handles strike tags found in the HTML source file.

Parameters:
attributes - the array of attributes from which the tag will be constructed.
Throws:
TagException - if an error is encountered constructing the tag.

handleTag_strong

public void handleTag_strong(java.lang.String[][] attributes)
Handles strong tags found in the HTML source file.

Parameters:
attributes - the array of attributes from which the tag will be constructed.
Throws:
TagException - if an error is encountered constructing the tag.

handleTag_style

public void handleTag_style(java.lang.String[][] attributes)
Handles style tags found in the HTML source file.

Parameters:
attributes - the array of attributes from which the tag will be constructed.
Throws:
TagException - if an error is encountered constructing the tag.

handleTag_sub

public void handleTag_sub(java.lang.String[][] attributes)
Handles sub tags found in the HTML source file.

Parameters:
attributes - the array of attributes from which the tag will be constructed.
Throws:
TagException - if an error is encountered constructing the tag.

handleTag_sup

public void handleTag_sup(java.lang.String[][] attributes)
Handles sup tags found in the HTML source file.

Parameters:
attributes - the array of attributes from which the tag will be constructed.
Throws:
TagException - if an error is encountered constructing the tag.

handleTag_table

public void handleTag_table(java.lang.String[][] attributes)
Handles table tags found in the HTML source file.

Parameters:
attributes - the array of attributes from which the tag will be constructed.
Throws:
TagException - if an error is encountered constructing the tag.

handleTag_tbody

public void handleTag_tbody(java.lang.String[][] attributes)
Handles tbody tags found in the HTML source file.

Parameters:
attributes - the array of attributes from which the tag will be constructed.
Throws:
TagException - if an error is encountered constructing the tag.

handleTag_td

public void handleTag_td(java.lang.String[][] attributes)
Handles td tags found in the HTML source file.

Parameters:
attributes - the array of attributes from which the tag will be constructed.
Throws:
TagException - if an error is encountered constructing the tag.

handleTag_textarea

public void handleTag_textarea(java.lang.String[][] attributes)
Handles textarea tags found in the HTML source file.

Parameters:
attributes - the array of attributes from which the tag will be constructed.

handleTag_tfoot

public void handleTag_tfoot(java.lang.String[][] attributes)
Handles tfoot tags found in the HTML source file.

Parameters:
attributes - the array of attributes from which the tag will be constructed.
Throws:
TagException - if an error is encountered constructing the tag.

handleTag_th

public void handleTag_th(java.lang.String[][] attributes)
Handles th tags found in the HTML source file.

Parameters:
attributes - the array of attributes from which the tag will be constructed.
Throws:
TagException - if an error is encountered constructing the tag.

handleTag_thead

public void handleTag_thead(java.lang.String[][] attributes)
Handles thead tags found in the HTML source file.

Parameters:
attributes - the array of attributes from which the tag will be constructed.
Throws:
TagException - if an error is encountered constructing the tag.

handleTag_title

public void handleTag_title(java.lang.String[][] attributes)
Handles title tags found in the HTML source file.

Parameters:
attributes - the array of attributes from which the tag will be constructed.
Throws:
TagException - if an error is encountered constructing the tag.

handleTag_tr

public void handleTag_tr(java.lang.String[][] attributes)
Handles tr tags found in the HTML source file.

Parameters:
attributes - the array of attributes from which the tag will be constructed.
Throws:
TagException - if an error is encountered constructing the tag.

handleTag_tt

public void handleTag_tt(java.lang.String[][] attributes)
Handles tt tags found in the HTML source file.

Parameters:
attributes - the array of attributes from which the tag will be constructed.
Throws:
TagException - if an error is encountered constructing the tag.

handleTag_u

public void handleTag_u(java.lang.String[][] attributes)
Handles u tags found in the HTML source file.

Parameters:
attributes - the array of attributes from which the tag will be constructed.
Throws:
TagException - if an error is encountered constructing the tag.

handleTag_ul

public void handleTag_ul(java.lang.String[][] attributes)
Handles ul tags found in the HTML source file.

Parameters:
attributes - the array of attributes from which the tag will be constructed.
Throws:
TagException - if an error is encountered constructing the tag.

handleTag_var

public void handleTag_var(java.lang.String[][] attributes)
Handles var tags found in the HTML source file.

Parameters:
attributes - the array of attributes from which the tag will be constructed.
Throws:
TagException - if an error is encountered constructing the tag.

handleText

public java.lang.String handleText(java.lang.String[][] attributes)
Handles the text between a start and end tag.

Parameters:
attributes - the array of attributes from which the tag will be constructed.
Returns:
the text between a start and end tag.
See Also:
handleTag_option(java.lang.String[][]), handleTag_title(java.lang.String[][])

handleUnclosedFormattedTextTags

public void handleUnclosedFormattedTextTags(java.lang.String[][] attributes)
Attempts to handle a missing end tag of any FormattedText objects.

Parameters:
attributes - the array of attributes from the tag about to be constructed.

handleUnclosedTag_colgroup

public boolean handleUnclosedTag_colgroup(java.lang.String[][] attributes)
Attempts to handle a missing </colgroup> tag.

Parameters:
attributes - the array of attributes from the tag about to be constructed.
Returns:
true if the </colgroup> tag was assumed to have been in the source document.

handleUnclosedTag_dd

public boolean handleUnclosedTag_dd(java.lang.String[][] attributes)
Attempts to handle a missing </dd> tag.

Parameters:
attributes - the array of attributes from the tag about to be constructed.
Returns:
true if the </dd> tag was assumed to have been in the source document.

handleUnclosedTag_dt

public boolean handleUnclosedTag_dt(java.lang.String[][] attributes)
Attempts to handle a missing </dt> tag.

Parameters:
attributes - the array of attributes from the tag about to be constructed.
Returns:
true if the </dt> tag was assumed to have been in the source document.

handleUnclosedTag_li

public boolean handleUnclosedTag_li(java.lang.String[][] attributes)
Attempts to handle a missing </li> tag.

Parameters:
attributes - the array of attributes from the tag about to be constructed.
Returns:
true if the </li> tag was assumed to have been in the source document.

handleUnclosedTag_option

public boolean handleUnclosedTag_option(java.lang.String[][] attributes)
Attempts to handle a missing </option> tag.

Parameters:
attributes - the array of attributes from the tag about to be constructed.
Returns:
true if the </option> tag was assumed to have been in the source document.

handleUnclosedTag_p

public boolean handleUnclosedTag_p(java.lang.String[][] attributes)
Attempts to handle a missing </p> tag.

Parameters:
attributes - the array of attributes from the tag about to be constructed.
Returns:
true if the </p> tag was assumed to have been in the source document.

setLogging

public void setLogging(javax.servlet.ServletContext context)
Turns on debug logging. Messages will be logged to the specified ServletContext log method.

Parameters:
context - the context to which messages will be logged. If null, debug logging is turned off.

setSuppressWarning

public PajeTemplate setSuppressWarning(boolean on)
Allows the suppression of the JavaScript alert warning in the generated document warning of parser errors. The errors will still appear as comments in the header.

Parameters:
on - true if the warning is to be suppressed, or false if it is to be generated (the default).
Returns:
the modified PajeTemplate instance.

addDiscardedUnexpectedTagWarning

protected PajeTemplateWarning addDiscardedUnexpectedTagWarning(java.lang.String[][] attributes)
Adds a "Discarding unexpected <tag>>" warning message.

Parameters:
attributes - the array of attributes that make up the tag being processed.
Returns:
The warning message instance.

addToContainer

protected void addToContainer(HTML html)
Adds the specfied HTML object to the current container.

Parameters:
html - the HTML object to be added to the current container.

addToContainer

protected void addToContainer(HTML html,
                              boolean push)
Adds the specfied HTML object to the current container.

Parameters:
html - the HTML object to be added to the current container.
push - if true, and the HTML object is an instance of Container, the Container will be pushed on to the Container stack.

addToContainer

protected void addToContainer(java.lang.String text)
Adds the specfied text to the current container as PlainText (ie with no character encoding).

Parameters:
text - the text to be added to the current container.

addWarning

protected PajeTemplateWarning addWarning(java.lang.String message,
                                         java.lang.String[][] attributes)
Adds a warning message.

Parameters:
message - the message text.
attributes - the array of attributes that make up the tag being processed.
Returns:
The warning message instance.

clearWarnings

protected void clearWarnings()
Clears any warnings that were created by the last generate(org.pajes.html.PajeParser).


dumpAttributes

protected void dumpAttributes(java.lang.String[][] attributes)
Internal debugging method to dump the attributes array to System.out.

Parameters:
attributes - the array of attributes to be dumped.

getAttributeIndex

protected int getAttributeIndex(java.lang.String[][] attributes,
                                java.lang.String name)
Returns the index of the specified attribute in an array of attributes.

Parameters:
attributes - The array of attributes to be searched.
name - The attribute name to be located.
Returns:
the index of the specified attribute name within the array, or -1 if it was not found.

getAttributeValue

protected java.lang.String getAttributeValue(java.lang.String[][] attributes,
                                             java.lang.String name)
Returns the value of the specified attribute in an array of attributes.

Parameters:
attributes - The array of attributes to be searched.
name - The attribute name to be located.
Returns:
the value of the specified attribute name within the array, or null if it was not found.

getCurrentContainer

protected Container getCurrentContainer()
Returns the container to which objects are currently being added.

Returns:
the top-most container on the stack.

getCurrentForm

protected Form getCurrentForm()
Returns the current HTML form to which objects are being added.

Returns:
the Form to which items are currently being added. If the <form> tag has not been parsed, or the </form> tag has been processed, null will be returned.

handleEmptyTag

protected void handleEmptyTag(java.lang.String[][] attributes)
Checks for and handles an empty tag.

Parameters:
attributes - the array of attributes from which the tag was constructed.

handleTag

protected void handleTag(java.lang.String[][] attributes)
Determines and passes to control to the appropriate handleTag_XXX method to process the tag represented by the specified attributes.

Parameters:
attributes - the array of attributes from which the tag will be constructed.

log

protected void log(java.lang.String msg)
Logs a message to the ServletContext, if logging is enabled.

Parameters:
msg - the message.

log

protected void log(java.lang.String msg,
                   HTML html)
Logs a message and an HTML object to the ServletContext.

Parameters:
msg - the message.
html - the object to be logged.

log

protected void log(java.lang.String part1,
                   java.lang.String part2)
Logs a message to the ServletContext.

Parameters:
part1 - Part 1 of the message.
part2 - Part 2 of the message.

log

protected void log(java.lang.String part1,
                   java.lang.String part2,
                   java.lang.String part3)
Logs a message to the ServletContext.

Parameters:
part1 - Part 1 of the message.
part2 - Part 2 of the message.
part3 - Part 3 of the message.

log

protected void log(java.lang.String part1,
                   java.lang.String part2,
                   java.lang.String part3,
                   java.lang.Class<?> part4)
Logs a message to the ServletContext.

Parameters:
part1 - Part 1 of the message.
part2 - Part 2 of the message.
part3 - Part 3 of the message.
part4 - Part 4 of the message.

log

protected void log(java.lang.String msg,
                   java.lang.String[][] attributes)
Logs a message and set of attributes to the ServletContext.

Parameters:
msg - the message.
attributes - the array of attributes.

log

protected void log(java.lang.Throwable t)
Logs a stack trace to the ServletContext.

Parameters:
t - the Throwable instance.

popCurrentContainer

protected Container popCurrentContainer()
Removes the current container from the top of the stack.

Returns:
the container removed from the stack.

popCurrentPsuedoContainer

protected Container popCurrentPsuedoContainer(Tag tag,
                                              java.lang.String[][] endTagAttributes)
Removes the current container from the top of the stack and populates the specified tag with the attributes specified on the opening tag.

Parameters:
tag - the tag to be populated with the attributes.
endTagAttributes - the end tag attributes (for creation of a warning if no matching opening tag was found).
Returns:
the container with the current content, or null if an end tag was encountered without a corresponding opening tag.

postProcessDocument

protected void postProcessDocument(Paje document)
Called immediately after all tags have been added to the document.

Sub-classes may over-ride this method to do document-specific processing. This implementation verifies that the source HTML file contains all elements that have been specifically identified with constants in this class. Therefore, the sub-class should call super.postProcessDocument(document) as the first thing in any over-ride method.

Parameters:
document - the Paje instance that will be cloned to be returned when requested.

postProcessTag

protected HTML postProcessTag(HTML tag)
Called immediately before adding the tag to the document, but after any field or id specific processing.

Sub-classes may over-ride this method to do document-specific tag processing, such as replacing a generic InputString instance with a specific sub-class to do correct validation. The default implementation returns the tag with no modification.

Parameters:
tag - the HTML instance that will be added to the document.
Returns:
the HTML instance that will be added to the document.

setWarning

protected PajeTemplateWarning setWarning(java.lang.String message,
                                         java.lang.String[][] attributes)
Deprecated. Use addWarning(String, String[][]) instead.


PAJES 3.0.21

Copyright 1998-2007 Viridian Pty Limited. All Rights Reserved.