multivalent.std.adaptor

Class HTML

public class HTML extends ML

Media adaptor for HTML (.html => document tree). Also see HTML Performance Notes. Doesn't quite do as much as Mozilla's browser component yet, but an order of magnitude smaller.

HTML fixups:

Parts of HTML 4.01 not yet supported:

Use as parser, see instructions in superclass MediaAdaptor. Tree looks like this:

Version: $Revision: 1.24 $ $Date: 2003/06/01 07:28:50 $

Field Summary
static FileFilterFILTER
static StringMSG_FORM_POPULATE
Set values of HTML FORM.
static StringMSG_FORM_PROCESS
Give chance for client-side processing by another behavior before sending to server.
static StringMSG_FORM_RESET
Reset settings of HTML FORM.
static StringMSG_FORM_SUBMIT
Submit HTML FORM to server.
static intTAGTYPE_EMPTY
static intTAGTYPE_NEST
static intTAGTYPE_NONEST
static intTAGTYPE_SPAN
static intTAGTYPE_UNKNOWN
int[]TagUse
Number of times open-tag of given id is used in document.
Constructor Summary
HTML()
Method Summary
voiddestroy()
protected voideatSpace()
Overrides because "In HTML, only the following characters are defined as white space characters: ASCII space ( ) ASCII tab ( ) ASCII form feed ( ) Zero-width space (​)" ...
static bytegetAlign(String spec)
static StringgetEntity(char unicode)
Return entity corresponding to given Unicode character, if any.
static intgetParseType(String tag)
Less efficient than HTML.
static intgetParseType(int tagid)
Parse type is TAGTYPE_EMPTY, TAGTYPE_SPAN, TAGTYPE_NEST, TAGTYPE_NONEST, or TAGTYPE_UNKNOWN if tag is unknown.
static chargetUnicode(String entity)
Return Unicode character corresponding to given HTML entity reference.
static bytegetVAlign(String spec)
static voidgo(Node startn, Object replace, Object ouri)
TARGET-aware hyperlink.
Objectparse(INode parent)
Normalizes in direction of XHTML: lowercase tag and attribute names, well nested (except for spans), ...
booleansemanticEventAfter(SemanticEvent se, String msg)
Form processing.
booleansemanticEventBefore(SemanticEvent se, String msg)
Adds LINKs to Go menu and document popup.

Field Detail

FILTER

public static final FileFilter FILTER

MSG_FORM_POPULATE

public static final String MSG_FORM_POPULATE
Set values of HTML FORM.

"populateForm": arg= java.util.Map attributes, in= java.util.Map name-value pairs.

MSG_FORM_PROCESS

public static final String MSG_FORM_PROCESS
Give chance for client-side processing by another behavior before sending to server.

"processForm": arg= java.util.Map attributes, in= INode root of tree, out=unused.

MSG_FORM_RESET

public static final String MSG_FORM_RESET
Reset settings of HTML FORM.

"resetForm": arg= Node top-of-form,

MSG_FORM_SUBMIT

public static final String MSG_FORM_SUBMIT
Submit HTML FORM to server.

"submitForm": arg= Node top-of-form,

TAGTYPE_EMPTY

public static final int TAGTYPE_EMPTY

TAGTYPE_NEST

public static final int TAGTYPE_NEST

TAGTYPE_NONEST

public static final int TAGTYPE_NONEST

TAGTYPE_SPAN

public static final int TAGTYPE_SPAN

TAGTYPE_UNKNOWN

public static final int TAGTYPE_UNKNOWN

TagUse

public int[] TagUse
Number of times open-tag of given id is used in document.

Constructor Detail

HTML

public HTML()

Method Detail

destroy

public void destroy()

eatSpace

protected void eatSpace()
Overrides because "In HTML, only the following characters are defined as white space characters: ASCII space ( ) ASCII tab ( ) ASCII form feed ( ) Zero-width space (​)" ... "All line breaks constitute white space. "

getAlign

public static byte getAlign(String spec)

getEntity

public static String getEntity(char unicode)
Return entity corresponding to given Unicode character, if any. If no such entity, return null.

getParseType

public static int getParseType(String tag)
Less efficient than HTML.

getParseType

public static int getParseType(int tagid)
Parse type is TAGTYPE_EMPTY, TAGTYPE_SPAN, TAGTYPE_NEST, TAGTYPE_NONEST, or TAGTYPE_UNKNOWN if tag is unknown.

getUnicode

public static char getUnicode(String entity)
Return Unicode character corresponding to given HTML entity reference. If no such character, return '\0'.

getVAlign

public static byte getVAlign(String spec)

go

public static void go(Node startn, Object replace, Object ouri)
TARGET-aware hyperlink. Shared by A HREF and IMG MAP

parse

public Object parse(INode parent)
Normalizes in direction of XHTML: lowercase tag and attribute names, well nested (except for spans), ... Within generated tree, all tags (GIs) are interned. This fact is exploited while parsing, but not afterward (when gleaning FORM, say) as other behaviors could have hacked tree and not been careful to intern (or always use literal Strings).

semanticEventAfter

public boolean semanticEventAfter(SemanticEvent se, String msg)
Form processing. Later, submittedForm so can intercept for client-side forms processing.

semanticEventBefore

public boolean semanticEventBefore(SemanticEvent se, String msg)
Adds LINKs to Go menu and document popup.