Class HTMLParsingRules
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class HTMLParsingRules *Beta API*

public class netscape.application.HTMLParsingRules
    extends java.lang.Object
    implements netscape.util.Codable
{
    /* Fields
     */
    public final static String BEGIN_TERMINATION_MARKERS_KEY;
    public final static String COMMENT_MARKER_KEY;
    public final static String END_TERMINATION_MARKERS_KEY;
    public final static String IS_CONTAINER_KEY;
    public final static String REPRESENTATION_KEY;
    public final static String SHOULD_IGNORE_END_KEY;
    public final static String SHOULD_RETAIN_FORMATTING_KEY;
    public final static String STRING_MARKER_KEY;

    /* Constructors
     */
    public HTMLParsingRules();

    /* Methods
     */
    public String classNameForComment();
    public String classNameForMarker(String);
    public String classNameForString();
    public void decode(Decoder);
    public String defaultContainerClassName();
    public String defaultMarkerClassName();
    public void describeClassInfo(ClassInfo);
    public void encode(Encoder);
    public void finishDecoding();
    public Hashtable rulesForMarker(String);
    public void setClassNameForComment(String);
    public void setClassNameForMarker(String, String);
    public void setDefaultContainerClassName(String);
    public void setDefaultMarkerClassName(String);
    public void setRuleForMarker(String, Object, String);
    public void setRulesForMarker(Hashtable, String);
    public void setStringClassName(String);
}
Instance of this class describe the rules used to parse some html.

Fields

STRING_MARKER_KEY

  public final static String STRING_MARKER_KEY
This is not a real HTML marker, however this marker is used to mean "a String"

COMMENT_MARKER_KEY

  public final static String COMMENT_MARKER_KEY
This is not a real HTML marker, however this marker is used to mean "a Comment"

REPRESENTATION_KEY

  public final static String REPRESENTATION_KEY
The class that should be used to represent an HTML component There is no default value although it is possible to set a default class for a String, a Container or a marker

BEGIN_TERMINATION_MARKERS_KEY

  public final static String BEGIN_TERMINATION_MARKERS_KEY
This parameter is a list of markers. If the parser finds this marker in a begin form ()while parsing the HTML component, it will assume the end of the component.

END_TERMINATION_MARKERS_KEY

  public final static String END_TERMINATION_MARKERS_KEY
This parameter is a list of markers. If the parser finds this marker in an ending form () while parsing the HTML component, it will assume the end of the component

IS_CONTAINER_KEY

  public final static String IS_CONTAINER_KEY
This parameter defines whether the html component is a container or not. default value is true

SHOULD_RETAIN_FORMATTING_KEY

  public final static String SHOULD_RETAIN_FORMATTING_KEY
This parameter defines whether the html component requires the strings inside itself to be formated or not. default value is false

SHOULD_IGNORE_END_KEY

  public final static String SHOULD_IGNORE_END_KEY
If true, the end of marker should be ignored. This is currently used for

. Default value is false

Constructors

HTMLParsingRules

  public HTMLParsingRules()

Methods

setRulesForMarker

  public void setRulesForMarker(Hashtable markerRules,
                                String marker)
Set the rules for a given marker. You can use this API to teach the parser how unsupported markers behave. Possible keys are: REPRESENTATION_KEY: (Class) the class that should be used to represent the marker BEGIN_TERMINATION_MARKERS_KEY: (Vector) list of marker that terminate the marker when they are beginning. END_TERMINATION_MARKERS_KEY: (Vector) list of marker that terminate the marker when they are ending. IS_CONTAINER_KEY: (String) "true" if the marker is a container. "false" otherwise SHOULD_RETAIN_FORMATTING_KEY (String) if "true", the parser does not remove \n ' ' and '\t' from the data inside the container. This is useful for markers like PRE

rulesForMarker

  public Hashtable rulesForMarker(String aMarker)
Return the current rules for aMarker

setRuleForMarker

  public void setRuleForMarker(String rule,
                               Object value,
                               String marker)
Convenience to set a single rule for a marker

setClassNameForMarker

  public void setClassNameForMarker(String className,
                                    String aMarker)
Convenience to define the class that should be used to store an HTML component with the marker aMarker. If aMarker is STRING_MARKER_KEY or COMMENT_MARKER_KEY, this method will define which class should be used to store a String or comments. aClass should be a subclass of TextViewHTMLElement.

classNameForMarker

  public String classNameForMarker(String aMarker)
Return the name of the class that will be used to store a component with the marker aMarker if no specific class has been affected to the marker, this method will try the default classes. If no default exists, return null

setDefaultContainerClassName

  public void setDefaultContainerClassName(String aClassName)
Set the name of the default class to be use to store container components This class is used if no other class has been specified by using setClassNameForMarker() or setRulesForMarker()

defaultContainerClassName

  public String defaultContainerClassName()
Return the default container class

setDefaultMarkerClassName

  public void setDefaultMarkerClassName(String aClassName)
Set the name of the default class to be use to store markers components This class is used if no other class has been specified by using setClassForMarker() or setRulesForMarker()

defaultMarkerClassName

  public String defaultMarkerClassName()
Return the default marker class

setStringClassName

  public void setStringClassName(String className)
Set the name of the class that should be used to store a String The class should be a subclass of TextViewHTMLElement.

classNameForString

  public String classNameForString()
Return the class that is used to store a String

setClassNameForComment

  public void setClassNameForComment(String className)
Set the name of the class that should be used to store a comment The class should be a subclass of TextViewHTMLElement.

classNameForComment

  public String classNameForComment()
Return the class name that is used to store a comment

describeClassInfo

  public void describeClassInfo(ClassInfo info)
Describes the HTMLParsingRules class's information.
See Also:
describeClassInfo

encode

  public void encode(Encoder encoder) throws CodingException
Encodes the HTMLParsingRules instance.
See Also:
encode

decode

  public void decode(Decoder decoder) throws CodingException
Decodes the HTMLParsingRules instance.
See Also:
decode

finishDecoding

  public void finishDecoding() throws CodingException
Finishes the HTMLParsingRules instance decoding.
See Also:
finishDecoding

All Packages  Class Hierarchy  This Package  Previous  Next  Index

Copyright © 1997 Netscape Communications Corporation. All rights reserved
Please send any comments or corrections to ifcfeedback@netscape.com
HTML generated on 21 Apr 1997