au.id.jericho.lib.html

Class EndTagType

Known Direct Subclasses:
EndTagTypeGenericImplementation

public abstract class EndTagType
extends TagType

Defines the syntax for an end tag type.

An end tag type is a TagType that starts with the characters '</'.

Instances of all the standard end tag types are available in this class as static fields.

See Also:
StartTagType

Field Summary

static EndTagType
NORMAL
The tag type given to a normal HTML or XML end tag (</name>).
static EndTagType
UNREGISTERED
The tag type given to an unregistered end tag (</ ... >).

Constructor Summary

EndTagType(String description, String startDelimiter, String closingDelimiter, boolean isServerTag)
Constructs a new EndTagType object with the specified properties.

Method Summary

protected EndTag
constructEndTag(Source source, int begin, int end, String name)
Internal method for the construction of an EndTag object of this type.
String
generateHTML(String startTagName)
Generates the HTML text of an end tag of this type given the name of a corresponding start tag.
StartTagType
getCorrespondingStartTagType()
Returns the type of start tag that is usually paired with an end tag of this type to form an Element.

Methods inherited from class au.id.jericho.lib.html.TagType

constructTagAt, deregister, getClosingDelimiter, getDescription, getNamePrefix, getRegisteredTagTypes, getStartDelimiter, getTagTypesIgnoringEnclosedMarkup, isServerTag, isValidPosition, register, setTagTypesIgnoringEnclosedMarkup, tagEncloses, toString

Field Details

NORMAL

public static final EndTagType NORMAL
The tag type given to a normal HTML or XML end tag (</name>).

Property/MethodValue
Description/normal
StartDelimiter</
ClosingDelimiter>
IsServerTagfalse
NamePrefix(empty string)
CorrespondingStartTagTypeStartTagType.NORMAL
generateHTML("StartTagName")</StartTagName>
</div>

UNREGISTERED

public static final EndTagType UNREGISTERED
The tag type given to an unregistered end tag (</ ... >).

See the documentation of the Tag.isUnregistered() method for details.

Property/MethodValue
Description/unregistered
StartDelimiter</
ClosingDelimiter>
IsServerTagfalse
NamePrefix(empty string)
CorrespondingStartTagTypenull
generateHTML("StartTagName")</StartTagName>
</ "This is not recognised as any of the predefined end tag types in this library">

Constructor Details

EndTagType

protected EndTagType(String description,
                     String startDelimiter,
                     String closingDelimiter,
                     boolean isServerTag)
Constructs a new EndTagType object with the specified properties.
(
implementation assistance method)

As EndTagType is an abstract class, this constructor is only called from sub-class constructors.

Parameters:
description - a description of the new end tag type useful for debugging purposes.
startDelimiter - the start delimiter of the new end tag type.
closingDelimiter - the closing delimiter of the new end tag type.
isServerTag - indicates whether the new end tag type is a server tag.

Method Details

constructEndTag

protected final EndTag constructEndTag(Source source,
                                       int begin,
                                       int end,
                                       String name)
Internal method for the construction of an EndTag object of this type.
(implementation assistance method)

Intended for use from within the constructTagAt(Source, int pos) method.

Parameters:
source - the Source document.
begin - the character position in the source document where this tag begins.
end - the character position in the source document where this tag ends.
name - the name of the tag.
Returns:
the new EndTag object.

generateHTML

public String generateHTML(String startTagName)
Generates the HTML text of an end tag of this type given the name of a corresponding start tag.
(property method)

This default implementation returns getStartDelimiter()+startTagName+getClosingDelimiter().

End Tag TypeHTML Generated for specified StartTagName
UNREGISTERED</StartTagName>
NORMAL</StartTagName>
End Tag TypeHTML Generated for specified StartTagName
MasonTagTypes.MASON_COMPONENT_CALLED_WITH_CONTENT_END</&>
MasonTagTypes.MASON_NAMED_BLOCK_END</%StartTagName>
Parameters:
startTagName - the name of a corresponding start tag.
Returns:
the HTML text of an end tag of this type given the name of a corresponding start tag.

getCorrespondingStartTagType

public StartTagType getCorrespondingStartTagType()
Returns the type of start tag that is usually paired with an end tag of this type to form an Element.
(default implementation method)

The default implementation returns null.

This property is informational only and is not used by the parser in any way.

The mapping of end tag type to the corresponding start tag type is in any case one-to-many, which is why the definition emphasises the word "usually". An example of this is the PHPTagTypes.PHP_SCRIPT start tag type, whose corresponding end tag type is EndTagType.NORMAL, while the converse is not true.

The only predefined end tag type that returns null for this property is the special UNREGISTERED end tag type.

Although this method is used like a property method, it is implemented as a default implementation method to avoid cyclic references between statically instantiated StartTagType and EndTagType objects.

End Tag TypeCorresponding Start Tag Type
UNREGISTEREDnull
NORMALStartTagType.NORMAL
End Tag TypeCorresponding Start Tag Type
MasonTagTypes.MASON_COMPONENT_CALLED_WITH_CONTENT_ENDMasonTagTypes.MASON_COMPONENT_CALLED_WITH_CONTENT
MasonTagTypes.MASON_NAMED_BLOCK_ENDMasonTagTypes.MASON_NAMED_BLOCK
Returns:
the type of start tag that is usually paired with an end tag of this type to form an Element.