Package org.htmlcleaner
Class DoctypeToken
- java.lang.Object
-
- org.htmlcleaner.BaseTokenImpl
-
- org.htmlcleaner.BaseHtmlNode
-
- org.htmlcleaner.DoctypeToken
-
public class DoctypeToken extends BaseHtmlNode implements HtmlNode
HTML doctype token.
-
-
Field Summary
Fields Modifier and Type Field Description static int
HTML4_0
static int
HTML4_01
static int
HTML4_01_FRAMESET
static int
HTML4_01_STRICT
static int
HTML4_01_TRANSITIONAL
static int
HTML5
static int
HTML5_LEGACY_TOOL_COMPATIBLE
private java.lang.String
part1
private java.lang.String
part2
private java.lang.String
part3
private java.lang.String
part4
private java.lang.Integer
type
The identified DocType, if anystatic int
UNKNOWN
private java.lang.Boolean
valid
static int
XHTML1_0_FRAMESET
static int
XHTML1_0_STRICT
static int
XHTML1_0_TRANSITIONAL
static int
XHTML1_1
static int
XHTML1_1_BASIC
-
Fields inherited from class org.htmlcleaner.BaseHtmlNode
parent
-
-
Constructor Summary
Constructors Constructor Description DoctypeToken(java.lang.String part1, java.lang.String part2, java.lang.String part3, java.lang.String part4)
DoctypeToken(java.lang.String part1, java.lang.String part2, java.lang.String part3, java.lang.String part4, java.lang.String part5)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description private java.lang.String
clean(java.lang.String s)
java.lang.String
getContent()
java.lang.String
getName()
java.lang.String
getPart1()
java.lang.String
getPart2()
java.lang.String
getPart3()
Deprecated.java.lang.String
getPart4()
Deprecated.java.lang.String
getPublicId()
This will retrieve the public ID of an externally referenced DTD, or an empty String if none is referenced.java.lang.String
getSystemId()
This will retrieve the system ID of an externally referenced DTD, or an empty String if none is referenced.int
getType()
This will retrieve an integer representing the identified DocTypeboolean
isValid()
void
serialize(Serializer serializer, java.io.Writer writer)
java.lang.String
toString()
private void
validate()
Checks the doctype according to W3C parsing rules and tries to identify the type and validity See: http://www.w3.org/TR/html-markup/syntax.html#doctype-syntax http://dev.w3.org/html5/html-author/#doctype-declaration-
Methods inherited from class org.htmlcleaner.BaseHtmlNode
getParent, getSiblings, setParent
-
Methods inherited from class org.htmlcleaner.BaseTokenImpl
getCol, getRow, setCol, setRow
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.htmlcleaner.HtmlNode
getParent, getSiblings, setParent
-
-
-
-
Field Detail
-
part1
private java.lang.String part1
-
part2
private java.lang.String part2
-
part3
private java.lang.String part3
-
part4
private java.lang.String part4
-
type
private java.lang.Integer type
The identified DocType, if any
-
UNKNOWN
public static final int UNKNOWN
- See Also:
- Constant Field Values
-
HTML4_0
public static final int HTML4_0
- See Also:
- Constant Field Values
-
HTML4_01
public static final int HTML4_01
- See Also:
- Constant Field Values
-
HTML4_01_STRICT
public static final int HTML4_01_STRICT
- See Also:
- Constant Field Values
-
HTML4_01_TRANSITIONAL
public static final int HTML4_01_TRANSITIONAL
- See Also:
- Constant Field Values
-
HTML4_01_FRAMESET
public static final int HTML4_01_FRAMESET
- See Also:
- Constant Field Values
-
XHTML1_0_STRICT
public static final int XHTML1_0_STRICT
- See Also:
- Constant Field Values
-
XHTML1_0_TRANSITIONAL
public static final int XHTML1_0_TRANSITIONAL
- See Also:
- Constant Field Values
-
XHTML1_0_FRAMESET
public static final int XHTML1_0_FRAMESET
- See Also:
- Constant Field Values
-
XHTML1_1
public static final int XHTML1_1
- See Also:
- Constant Field Values
-
XHTML1_1_BASIC
public static final int XHTML1_1_BASIC
- See Also:
- Constant Field Values
-
HTML5
public static final int HTML5
- See Also:
- Constant Field Values
-
HTML5_LEGACY_TOOL_COMPATIBLE
public static final int HTML5_LEGACY_TOOL_COMPATIBLE
- See Also:
- Constant Field Values
-
valid
private java.lang.Boolean valid
-
-
Constructor Detail
-
DoctypeToken
public DoctypeToken(java.lang.String part1, java.lang.String part2, java.lang.String part3, java.lang.String part4)
-
DoctypeToken
public DoctypeToken(java.lang.String part1, java.lang.String part2, java.lang.String part3, java.lang.String part4, java.lang.String part5)
-
-
Method Detail
-
clean
private java.lang.String clean(java.lang.String s)
-
isValid
public boolean isValid()
-
validate
private void validate()
Checks the doctype according to W3C parsing rules and tries to identify the type and validity See:- http://www.w3.org/TR/html-markup/syntax.html#doctype-syntax
- http://dev.w3.org/html5/html-author/#doctype-declaration
-
getContent
public java.lang.String getContent()
-
toString
public java.lang.String toString()
- Overrides:
toString
in classBaseTokenImpl
-
getType
public int getType()
This will retrieve an integer representing the identified DocType
-
getName
public java.lang.String getName()
-
serialize
public void serialize(Serializer serializer, java.io.Writer writer) throws java.io.IOException
- Specified by:
serialize
in interfaceBaseToken
- Overrides:
serialize
in classBaseHtmlNode
- Throws:
java.io.IOException
-
getPublicId
public java.lang.String getPublicId()
This will retrieve the public ID of an externally referenced DTD, or an empty String if none is referenced.
-
getSystemId
public java.lang.String getSystemId()
This will retrieve the system ID of an externally referenced DTD, or an empty String if none is referenced.
-
getPart1
public java.lang.String getPart1()
-
getPart2
public java.lang.String getPart2()
-
getPart3
@Deprecated public java.lang.String getPart3()
Deprecated.Deprecated - use getPublicId() instead- Returns:
- the third part of the DOCSTRING
-
getPart4
@Deprecated public java.lang.String getPart4()
Deprecated.Deprecated - use getSystemId() instead- Returns:
- the fourth part of the DOCSTRING
-
-