Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Object
au.id.jericho.lib.html.Segment
au.id.jericho.lib.html.Tag
au.id.jericho.lib.html.EndTag
public final class EndTag
extends Tag
EndTagType
, meaning it
always starts with the characters '</
'.
EndTag
instances are obtained using one of the following methods:
Element.getEndTag()
Tag.findNextTag()
Tag.findPreviousTag()
Source.findPreviousEndTag(int pos)
Source.findPreviousEndTag(int pos, String name)
Source.findPreviousTag(int pos)
Source.findPreviousTag(int pos, TagType)
Source.findNextEndTag(int pos)
Source.findNextEndTag(int pos, String name)
Source.findNextEndTag(int pos, String name, EndTagType)
Source.findNextTag(int pos)
Source.findNextTag(int pos, TagType)
Source.findEnclosingTag(int pos)
Source.findEnclosingTag(int pos, TagType)
Source.getTagAt(int pos)
Segment.findAllTags()
Segment.findAllTags(TagType)
Tag
superclass defines the getName()
method used to get the name of this end tag.
See also the XML 1.0 specification for end tags.
Fields inherited from interface au.id.jericho.lib.html.HTMLElementName | |
A , ABBR , ACRONYM , ADDRESS , APPLET , AREA , B , BASE , BASEFONT , BDO , BIG , BLOCKQUOTE , BODY , BR , BUTTON , CAPTION , CENTER , CITE , CODE , COL , COLGROUP , DD , DEL , DFN , DIR , DIV , DL , DT , EM , FIELDSET , FONT , FORM , FRAME , FRAMESET , H1 , H2 , H3 , H4 , H5 , H6 , HEAD , HR , HTML , I , IFRAME , IMG , INPUT , INS , ISINDEX , KBD , LABEL , LEGEND , LI , LINK , MAP , MENU , META , NOFRAMES , NOSCRIPT , OBJECT , OL , OPTGROUP , OPTION , P , PARAM , PRE , Q , S , SAMP , SCRIPT , SELECT , SMALL , SPAN , STRIKE , STRONG , STYLE , SUB , SUP , TABLE , TBODY , TD , TEXTAREA , TFOOT , TH , THEAD , TITLE , TR , TT , U , UL , VAR |
Method Summary | |
static String |
|
String |
|
Element |
|
EndTagType |
|
TagType |
|
boolean |
|
String |
|
Methods inherited from class au.id.jericho.lib.html.Tag | |
findNextTag , findPreviousTag , getElement , getName , getNameSegment , getTagType , getUserData , isUnregistered , isXMLName , isXMLNameChar , isXMLNameStartChar , setUserData , tidy |
Methods inherited from class au.id.jericho.lib.html.Segment | |
charAt , compareTo , encloses , encloses , equals , extractText , extractText , findAllCharacterReferences , findAllElements , findAllElements , findAllElements , findAllElements , findAllStartTags , findAllStartTags , findAllStartTags , findAllTags , findAllTags , findFormControls , findFormFields , getBegin , getChildElements , getDebugInfo , getEnd , getRenderer , getTextExtractor , hashCode , ignoreWhenParsing , isWhiteSpace , isWhiteSpace , length , parseAttributes , subSequence , toString |
public static String generateHTML(String tagName)
Generates the HTML text of a normal end tag with the specified tag name.Example:
The following method call:EndTag.generateHTML("INPUT")
returns the following output:</INPUT>
- Parameters:
tagName
- the name of the end tag.
- See Also:
StartTag.generateHTML(String tagName, Map attributesMap, boolean emptyElementTag)
public String getDebugInfo()
Returns a string representation of this object useful for debugging purposes.
- Overrides:
- getDebugInfo in interface Segment
- Returns:
- a string representation of this object useful for debugging purposes.
public Element getElement()
Returns the element that is ended by this end tag. Returnsnull
if this end tag is not properly matched to any start tag in the source document. This method is much less efficient than theStartTag.getElement()
method. IMPLEMENTATION NOTE: The explanation for why this method is relatively inefficient lies in the fact that more than one start tag type can have the same corresponding end tag type, so it is not possible to know for certain which type of start tag this end tag is matched to (seeEndTagType.getCorrespondingStartTagType()
for more explanation). Because of this uncertainty, the implementation of this method must check every start tag preceding this end tag, calling itsStartTag.getElement()
method to see whether it is terminated by this end tag.
- Overrides:
- getElement in interface Tag
- Returns:
- the element that is ended by this end tag.
public TagType getTagType()
Returns the type of this tag.
- Overrides:
- getTagType in interface Tag
- Returns:
- the type of this tag.
public boolean isUnregistered()
Indicates whether this tag has a syntax that does not match any of the registered tag types. The only requirement of an unregistered tag type is that it starts with '<
' and there is a closing '>
' character at some position after it in the source document. The absence or presence of a '/
' character after the initial '<
' determines whether an unregistered tag is respectively aStartTag
with a type ofStartTagType.UNREGISTERED
or anEndTag
with a type ofEndTagType.UNREGISTERED
. There are no restrictions on the characters that might appear between these delimiters, including other '<
' characters. This may result in a '>
' character that is identified as the closing delimiter of two separate tags, one an unregistered tag, and the other a tag of any type that begins in the middle of the unregistered tag. As explained below, unregistered tags are usually only found when specifically looking for them, so it is up to the user to detect and deal with any such nonsensical results. Unregistered tags are only returned by theSource.getTagAt(int pos)
method, named search methods, where the specifiedname
matches the first characters inside the tag, and by tag type search methods, where the specifiedtagType
is eitherStartTagType.UNREGISTERED
orEndTagType.UNREGISTERED
. Open tag searches and other searches always ignore unregistered tags, although every discovery of an unregistered tag is logged by the parser. The logic behind this design is that unregistered tag types are usually the result of a '<
' character in the text that was mistakenly left unencoded, or a less-than operator inside a script, or some other occurrence which is of no interest to the user. By returning unregistered tags in named and tag type search methods, the library allows the user to specifically search for tags with a certain syntax that does not match any existingTagType
. This expediency feature avoids the need for the user to create a custom tag type to define the syntax before searching for these tags. By not returning unregistered tags in the less specific search methods, it is providing only the information that most users are interested in.
- Overrides:
- isUnregistered in interface Tag
- Returns:
true
if this tag has a syntax that does not match any of the registered tag types, otherwisefalse
.
public String tidy()
Returns an XML representation of this end tag. This method is included for symmetry with theStartTag.tidy()
method and simply returns the source text of the tag.
- Returns:
- an XML representation of this end tag.