simple.ml
Class ParserConstants

java.lang.Object
  extended by simple.ml.ParserConstants

public final class ParserConstants
extends java.lang.Object


Created: Oct 23, 2010

Author:
Kenneth Pierce

Field Summary
private  java.util.HashSet<CIString> OPTIONALEND
           
private  MVHashtable<CIString,CIString> OPTIONALENDEND
           
private  java.util.HashSet<CIString> PCDATA
           
private  java.util.HashSet<CIString> SELFCLOSER
           
private static CIString TAGA
           
 
Constructor Summary
ParserConstants()
           
 
Method Summary
 void addOptionalEnder(java.lang.String tag)
          Adds this tag as a tag that may or may not have a closing tag.
 void addOptionalEnderEnd(CIString otag, CIString etag)
          Adds this tag as a tag that will close the optional end tag when it opens.
 void addOptionalEnderEnd(java.lang.String otag, java.lang.String etag)
          Adds this tag as a tag that will close the optional end tag when it opens.
 void addPcdataTag(java.lang.String tag)
          Sets this tag as only containing PCDATA.
 void addSelfCloser(java.lang.String tag)
          Defines this tag as never having content or sub-tags.
 boolean isOptionalEnder(CIString tag)
          Checks to see if the end tag is optional for this tag.
 boolean isOptionalEnder(java.lang.String tag)
          Checks to see if the end tag is optional for this tag.
 boolean isOptionalEnderEnd(CIString otag, CIString etag)
          Checks to see if etag serves as an ending tag for otag.
 boolean isPcdataTag(CIString tag)
          Checks to see if the tag contains PCDATA.
 boolean isPcdataTag(java.lang.String tag)
          Checks to see if the tag contains PCDATA.
 boolean isSelfCloser(CIString tag)
          Checks to see if tag is a self-closer.
 boolean isSelfCloser(java.lang.String tag)
          Checks to see if tag is a self-closer.
 void load(java.io.File file)
          Loads the configuration file.
 void load(java.io.InputStream in)
          Loads the configuration file.
 void load(java.io.Reader in)
          Loads the configuration file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PCDATA

private final java.util.HashSet<CIString> PCDATA

SELFCLOSER

private final java.util.HashSet<CIString> SELFCLOSER

OPTIONALEND

private final java.util.HashSet<CIString> OPTIONALEND

OPTIONALENDEND

private final MVHashtable<CIString,CIString> OPTIONALENDEND

TAGA

private static final CIString TAGA
Constructor Detail

ParserConstants

public ParserConstants()
Method Detail

load

public void load(java.io.File file)
          throws java.io.IOException,
                 java.text.ParseException
Loads the configuration file.

Parameters:
file -
Throws:
java.io.IOException
java.text.ParseException

load

public void load(java.io.InputStream in)
          throws java.io.IOException,
                 java.text.ParseException
Loads the configuration file.

Parameters:
in -
Throws:
java.io.IOException
java.text.ParseException

load

public void load(java.io.Reader in)
          throws java.io.IOException,
                 java.text.ParseException
Loads the configuration file.

Parameters:
in -
Throws:
java.io.IOException
java.text.ParseException

addOptionalEnder

public void addOptionalEnder(java.lang.String tag)
Adds this tag as a tag that may or may not have a closing tag.

Parameters:
tag - the tag name

addOptionalEnderEnd

public void addOptionalEnderEnd(CIString otag,
                                CIString etag)
Adds this tag as a tag that will close the optional end tag when it opens. For example an opening li tag will close the previous li tag.

Parameters:
otag - The optional tag name
etag - The tag name that ends this tag

addOptionalEnderEnd

public void addOptionalEnderEnd(java.lang.String otag,
                                java.lang.String etag)
Adds this tag as a tag that will close the optional end tag when it opens. For example an opening li tag will close the previous li tag.

Parameters:
otag - The optional tag name
etag - The tag name that ends this tag

addSelfCloser

public void addSelfCloser(java.lang.String tag)
Defines this tag as never having content or sub-tags. Tags like "br" and "hr" belong here.

Parameters:
tag - The tag name

addPcdataTag

public void addPcdataTag(java.lang.String tag)
Sets this tag as only containing PCDATA. Tags like "style" and "script" belong here.

Parameters:
tag -

isOptionalEnder

public boolean isOptionalEnder(java.lang.String tag)
Checks to see if the end tag is optional for this tag.

Parameters:
tag - the tag name
Returns:
true if the end tag is optional for this tag.

isOptionalEnder

public boolean isOptionalEnder(CIString tag)
Checks to see if the end tag is optional for this tag.

Parameters:
tag - the tag name
Returns:
true if the end tag is optional for this tag.

isOptionalEnderEnd

public boolean isOptionalEnderEnd(CIString otag,
                                  CIString etag)
Checks to see if etag serves as an ending tag for otag.

Parameters:
otag - The optional tag name
etag - The ending tag name
Returns:
True if the opening tag for etag serves as a closing tag for otag.

isPcdataTag

public boolean isPcdataTag(java.lang.String tag)
Checks to see if the tag contains PCDATA.

Parameters:
tag - the tag name
Returns:
true if the contents of tag are to be treated as PCDATA

isPcdataTag

public boolean isPcdataTag(CIString tag)
Checks to see if the tag contains PCDATA.

Parameters:
tag - the tag name
Returns:
true if the contents of tag are to be treated as PCDATA

isSelfCloser

public boolean isSelfCloser(java.lang.String tag)
Checks to see if tag is a self-closer.

Parameters:
tag - the tag name
Returns:
true if the tag closes itself.

isSelfCloser

public boolean isSelfCloser(CIString tag)
Checks to see if tag is a self-closer.

Parameters:
tag - the tag name
Returns:
true if the tag closes itself.