Multivalent API

multivalent.std.adaptor
Class HTML

java.lang.Object
  extended by multivalent.VObject
      extended by multivalent.Behavior
          extended by multivalent.MediaAdaptor
              extended by multivalent.std.adaptor.ML
                  extended by multivalent.std.adaptor.HTML

public class HTML
extends ML

Media adaptor for HTML (.html => document tree).

Parts of HTML 4.01 not yet supported:

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

Version:
$Revision: 1.26 $ $Date: 2005/07/26 22:11:28 $

Field Summary
static java.io.FileFilter FILTER
           
static java.lang.String MSG_FORM_POPULATE
          Set values of HTML FORM.
static java.lang.String MSG_FORM_PROCESS
          Give chance for client-side processing by another behavior before sending to server.
static java.lang.String MSG_FORM_RESET
          Reset settings of HTML FORM.
static java.lang.String MSG_FORM_SUBMIT
          Submit HTML FORM to server.
static int TAGTYPE_EMPTY
           
static int TAGTYPE_NEST
           
static int TAGTYPE_NONEST
           
static int TAGTYPE_SPAN
           
static int TAGTYPE_UNKNOWN
           
 int[] TagUse
          Number of times open-tag of given id is used in document.
 
Fields inherited from class multivalent.std.adaptor.ML
entity_, errcnt, ir_, ispace, keepComments, keepWhitespace
 
Fields inherited from class multivalent.MediaAdaptor
HINT_DEFAULTS, HINT_EXACT, HINT_FAST, HINT_METADATA_ONLY, HINT_NO_IMAGE, HINT_NO_INTERACTIVE, HINT_NO_LAYOUT, HINT_NO_SHAPE, HINT_NO_SHOW, HINT_NO_STYLE, HINT_NO_TEXT, HINT_NO_TRANSCLUSION, HINT_NONE, HINT_NORMALIZE
 
Fields inherited from class multivalent.Behavior
ATTR_BEHAVIOR, name_
 
Fields inherited from class multivalent.VObject
attr_
 
Constructor Summary
HTML()
           
 
Method Summary
 void destroy()
          Protocol.
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 (​)" ...
static byte getAlign(java.lang.String spec)
           
static java.lang.String getEntity(int codepoint)
          Return entity corresponding to given Unicode character, if any.
static int getParseType(int tagid)
          Parse type is TAGTYPE_EMPTY, TAGTYPE_SPAN, TAGTYPE_NEST, TAGTYPE_NONEST, or TAGTYPE_UNKNOWN if tag is unknown.
static int getParseType(java.lang.String tag)
          Less efficient than getParseType(int).
static char getUnicode(java.lang.String entity)
          Return Unicode character corresponding to given HTML entity reference.
static byte getVAlign(java.lang.String spec)
           
static void go(Node startn, java.lang.Object replace, java.lang.Object ouri)
          TARGET-aware hyperlink.
 java.lang.Object parse(INode parent)
          Normalizes in direction of XHTML: lowercase tag and attribute names, well nested (except for spans), ...
 boolean semanticEventAfter(SemanticEvent se, java.lang.String msg)
          Form processing.
 boolean semanticEventBefore(SemanticEvent se, java.lang.String msg)
          Adds LINKs to Go menu and document popup.
 
Methods inherited from class multivalent.std.adaptor.ML
close, eatComment, getEntity, getReader, getTag, getTag, pairsWith, readChar, readString, readString, readString, readString, readStringInternal, setEntity
 
Methods inherited from class multivalent.MediaAdaptor
buildBefore, getHints, getInputUni, getURI, getZoom, isAuthorized, isStopped, parseHelper, setHints, setInput, setInput, setPassword, setZoom, stop
 
Methods inherited from class multivalent.Behavior
buildAfter, checkRep, clipboardAfter, clipboardBefore, createUI, eventAfter, eventBefore, formatAfter, formatBefore, getBrowser, getDocument, getInstance, getInstance, getLayer, getLogger, getName, getPreference, getRoot, isEditable, paintAfter, paintBefore, putPreference, redo, restore, restoreChildren, save, setName, toString, undo
 
Methods inherited from class multivalent.VObject
attrEntrySetIterator, attrKeysIterator, clearAttributes, getAttr, getAttr, getAttributes, getGlobal, getValue, hasAttributes, putAttr, removeAttr, setAttributes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MSG_FORM_SUBMIT

public static final java.lang.String MSG_FORM_SUBMIT
Submit HTML FORM to server.

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

See Also:
Constant Field Values

MSG_FORM_RESET

public static final java.lang.String MSG_FORM_RESET
Reset settings of HTML FORM.

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

See Also:
Constant Field Values

MSG_FORM_PROCESS

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

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

See Also:
Constant Field Values

MSG_FORM_POPULATE

public static final java.lang.String MSG_FORM_POPULATE
Set values of HTML FORM.

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

See Also:
Constant Field Values

FILTER

public static final java.io.FileFilter FILTER

TagUse

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


TAGTYPE_UNKNOWN

public static final int TAGTYPE_UNKNOWN
See Also:
Constant Field Values

TAGTYPE_EMPTY

public static final int TAGTYPE_EMPTY
See Also:
Constant Field Values

TAGTYPE_SPAN

public static final int TAGTYPE_SPAN
See Also:
Constant Field Values

TAGTYPE_NEST

public static final int TAGTYPE_NEST
See Also:
Constant Field Values

TAGTYPE_NONEST

public static final int TAGTYPE_NONEST
See Also:
Constant Field Values
Constructor Detail

HTML

public HTML()
Method Detail

destroy

public void destroy()
Description copied from class: Behavior
Protocol. Cleans up state before being decommissioned: remove from Layer, observed nodes, .... Clients shouldn't hold a pointer/handle to object after destroy() as it is in an invalid state. This protocol cannot be short-circuited.

Overrides:
destroy in class MediaAdaptor

getUnicode

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


getEntity

public static java.lang.String getEntity(int codepoint)
Return entity corresponding to given Unicode character, if any. If no such entity, return null.


getParseType

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


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.


getAlign

public static byte getAlign(java.lang.String spec)

getVAlign

public static byte getVAlign(java.lang.String spec)

eatSpace

protected void eatSpace()
                 throws java.io.IOException
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."

Overrides:
eatSpace in class ML
Throws:
java.io.IOException

parse

public java.lang.Object parse(INode parent)
                       throws java.lang.Exception
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).

Specified by:
parse in class MediaAdaptor
Returns:
whatever Object is appropriate to the media adaptor. For HTML it is the root of the HTML tree (which has name "html"), for documents with no single root it can be parent, for an image constuctor it could be an Image. However, the primary job of a media adaptor is to add content to the document tree.
Throws:
java.lang.Exception
See Also:
for a convenient way to attach spans

semanticEventBefore

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

Overrides:
semanticEventBefore in class Behavior

semanticEventAfter

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

Overrides:
semanticEventAfter in class MediaAdaptor

go

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


Multivalent API