code.google.com home

org.owasp.html
Enum HtmlTextEscapingMode

java.lang.Object
  extended by java.lang.Enum<HtmlTextEscapingMode>
      extended by org.owasp.html.HtmlTextEscapingMode
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<HtmlTextEscapingMode>

public enum HtmlTextEscapingMode
extends java.lang.Enum<HtmlTextEscapingMode>

From section 8.1.2.6 of http://www.whatwg.org/specs/web-apps/current-work/

The text in CDATA and RCDATA elements must not contain any occurrences of the string "), or U+002F SOLIDUS (/), unless that string is part of an escaping text span.

See also http://www.whatwg.org/specs/web-apps/current-work/#cdata-rcdata-restrictions for the elements which fall in each category.

Author:
Mike Samuel

Enum Constant Summary
CDATA
          A span of text where HTML special characters are interpreted literally, as in a SCRIPT tag.
CDATA_SOMETIMES
          Like CDATA but only for certain browsers.
PCDATA
          Normally escaped character data that breaks around comments and tags.
PLAIN_TEXT
          A span of text where HTML special characters are interpreted literally, where there is no end tag.
RCDATA
          A span of text and character entity references where HTML special characters are interpreted literally, as in a TITLE tag.
VOID
          Cannot contain data.
 
Method Summary
static boolean allowsEscapingTextSpan(java.lang.String canonTagName)
          True iff the content following the given tag allows escaping text spans: <!--&hellip;--> that escape even things that might be an end tag for the corresponding open tag.
static HtmlTextEscapingMode getModeForTag(java.lang.String canonTagName)
          The mode used for content following a start tag with the given name.
static boolean isTagFollowedByLiteralContent(java.lang.String canonTagName)
          True if content immediately following the start tag must be treated as special CDATA so that <'s are not treated as starting tags, comments or directives.
static boolean isVoidElement(java.lang.String canonTagName)
          True iff the tag cannot contain any content -- will an HTML parser consider the element to have ended immediately after the start tag.
static HtmlTextEscapingMode valueOf(java.lang.String name)
          Returns the enum constant of this type with the specified name.
static HtmlTextEscapingMode[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

PCDATA

public static final HtmlTextEscapingMode PCDATA
Normally escaped character data that breaks around comments and tags.


CDATA

public static final HtmlTextEscapingMode CDATA
A span of text where HTML special characters are interpreted literally, as in a SCRIPT tag.


CDATA_SOMETIMES

public static final HtmlTextEscapingMode CDATA_SOMETIMES
Like CDATA but only for certain browsers.


RCDATA

public static final HtmlTextEscapingMode RCDATA
A span of text and character entity references where HTML special characters are interpreted literally, as in a TITLE tag.


PLAIN_TEXT

public static final HtmlTextEscapingMode PLAIN_TEXT
A span of text where HTML special characters are interpreted literally, where there is no end tag. PLAIN_TEXT runs until the end of the file.


VOID

public static final HtmlTextEscapingMode VOID
Cannot contain data.

Method Detail

values

public static HtmlTextEscapingMode[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (HtmlTextEscapingMode c : HtmlTextEscapingMode.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static HtmlTextEscapingMode valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
java.lang.NullPointerException - if the argument is null

getModeForTag

public static HtmlTextEscapingMode getModeForTag(java.lang.String canonTagName)
The mode used for content following a start tag with the given name.


allowsEscapingTextSpan

public static boolean allowsEscapingTextSpan(java.lang.String canonTagName)
True iff the content following the given tag allows escaping text spans: <!--&hellip;--> that escape even things that might be an end tag for the corresponding open tag.


isTagFollowedByLiteralContent

public static boolean isTagFollowedByLiteralContent(java.lang.String canonTagName)
True if content immediately following the start tag must be treated as special CDATA so that <'s are not treated as starting tags, comments or directives.


isVoidElement

public static boolean isVoidElement(java.lang.String canonTagName)
True iff the tag cannot contain any content -- will an HTML parser consider the element to have ended immediately after the start tag.


code.google.com home