📄 tagtype.java
字号:
* This property must define the closing delimiter common to all instances of the tag type.
* <p>
* <dl>
* <dt>Standard Tag Type Values:</dt>
* <dd>
* <table class="bordered" style="margin: 15px" cellspacing="0">
* <tr><th>Tag Type<th>Closing Delimiter
* <tr><td>{@link StartTagType#UNREGISTERED}<td><code>></code>
* <tr><td>{@link StartTagType#NORMAL}<td><code>></code>
* <tr><td>{@link StartTagType#COMMENT}<td><code>--></code>
* <tr><td>{@link StartTagType#XML_DECLARATION}<td><code>?></code>
* <tr><td>{@link StartTagType#XML_PROCESSING_INSTRUCTION}<td><code>?></code>
* <tr><td>{@link StartTagType#DOCTYPE_DECLARATION}<td><code>></code>
* <tr><td>{@link StartTagType#MARKUP_DECLARATION}<td><code>></code>
* <tr><td>{@link StartTagType#CDATA_SECTION}<td><code>]]></code>
* <tr><td>{@link StartTagType#SERVER_COMMON}<td><code>%></code>
* <tr><td>{@link EndTagType#UNREGISTERED}<td><code>></code>
* <tr><td>{@link EndTagType#NORMAL}<td><code>></code>
* </table>
* </dl>
* <dl>
* <dt>Extended Tag Type Values:</dt>
* <dd>
* <table class="bordered" style="margin: 15px" cellspacing="0">
* <tr><th>Tag Type<th>Closing Delimiter
* <tr><td>{@link MicrosoftTagTypes#DOWNLEVEL_REVEALED_CONDITIONAL_COMMENT}<td><code>]></code>
* <tr><td>{@link PHPTagTypes#PHP_SCRIPT}<td><code>></code>
* <tr><td>{@link PHPTagTypes#PHP_SHORT}<td><code>?></code>
* <tr><td>{@link PHPTagTypes#PHP_STANDARD}<td><code>?></code>
* <tr><td>{@link MasonTagTypes#MASON_COMPONENT_CALL}<td><code>&></code>
* <tr><td>{@link MasonTagTypes#MASON_COMPONENT_CALLED_WITH_CONTENT}<td><code>&></code>
* <tr><td>{@link MasonTagTypes#MASON_COMPONENT_CALLED_WITH_CONTENT_END}<td><code>></code>
* <tr><td>{@link MasonTagTypes#MASON_NAMED_BLOCK}<td><code>></code>
* <tr><td>{@link MasonTagTypes#MASON_NAMED_BLOCK_END}<td><code>></code>
* </table>
* </dl>
*
* @return the character sequence that marks the end of the tag.
*/
public final String getClosingDelimiter() {
return closingDelimiter;
}
/**
* Indicates whether this tag type represents a server tag.
* <br />(<a href="TagType.html#Property">property</a> method)
* <p>
* Server tags are typically parsed by some process on the web server and substituted with other text or markup before delivery to the
* <a target="_blank" href="http://www.w3.org/TR/html401/conform.html#didx-user_agent">user agent</a>.
* This parser therefore handles them differently to non-server tags in that they can occur at any position in the document
* without regard for the HTML document structure.
* As a result they can occur anywhere inside any other tag, although a non-server tag cannot theoretically occur inside a server tag.
* <p>
* The documentation of the <a href="Tag.html#ParsingProcess">tag parsing process</a> explains in detail
* how the value of this property affects the recognition of server tags,
* as well as how the presence of server tags affects the recognition of non-server tags in and around them.
* <p>
* Most XML-style server tags can not be represented as a distinct tag type because they are generally indistinguishable from non-server XML tags.
* See the {@link Segment#ignoreWhenParsing()} method for information about how to prevent such server tags from interfering with the proper parsing
* of the rest of the document.
* <p>
* <dl>
* <dt>Standard Tag Type Values:</dt>
* <dd>
* <table class="bordered" style="margin: 15px" cellspacing="0">
* <tr><th>Tag Type<th>Is Server Tag
* <tr><td>{@link StartTagType#UNREGISTERED}<td><code>false</code>
* <tr><td>{@link StartTagType#NORMAL}<td><code>false</code>
* <tr><td>{@link StartTagType#COMMENT}<td><code>false</code>
* <tr><td>{@link StartTagType#XML_DECLARATION}<td><code>false</code>
* <tr><td>{@link StartTagType#XML_PROCESSING_INSTRUCTION}<td><code>false</code>
* <tr><td>{@link StartTagType#DOCTYPE_DECLARATION}<td><code>false</code>
* <tr><td>{@link StartTagType#MARKUP_DECLARATION}<td><code>false</code>
* <tr><td>{@link StartTagType#CDATA_SECTION}<td><code>false</code>
* <tr><td>{@link StartTagType#SERVER_COMMON}<td><code>true</code>
* <tr><td>{@link EndTagType#UNREGISTERED}<td><code>false</code>
* <tr><td>{@link EndTagType#NORMAL}<td><code>false</code>
* </table>
* </dl>
* <dl>
* <dt>Extended Tag Type Values:</dt>
* <dd>
* <table class="bordered" style="margin: 15px" cellspacing="0">
* <tr><th>Tag Type<th>Is Server Tag
* <tr><td>{@link MicrosoftTagTypes#DOWNLEVEL_REVEALED_CONDITIONAL_COMMENT}<td><code>false</code>
* <tr><td>{@link PHPTagTypes#PHP_SCRIPT}<td><code>true</code>
* <tr><td>{@link PHPTagTypes#PHP_SHORT}<td><code>true</code>
* <tr><td>{@link PHPTagTypes#PHP_STANDARD}<td><code>true</code>
* <tr><td>{@link MasonTagTypes#MASON_COMPONENT_CALL}<td><code>true</code>
* <tr><td>{@link MasonTagTypes#MASON_COMPONENT_CALLED_WITH_CONTENT}<td><code>true</code>
* <tr><td>{@link MasonTagTypes#MASON_COMPONENT_CALLED_WITH_CONTENT_END}<td><code>true</code>
* <tr><td>{@link MasonTagTypes#MASON_NAMED_BLOCK}<td><code>true</code>
* <tr><td>{@link MasonTagTypes#MASON_NAMED_BLOCK_END}<td><code>true</code>
* </table>
* </dl>
*
* @return <code>true</code> if this tag type represents a server tag, otherwise <code>false</code>.
*/
public final boolean isServerTag() {
return isServerTag;
}
/**
* Returns the {@linkplain Tag#getName() name} prefix required by this tag type.
* <br />(<a href="TagType.html#Property">property</a> method)
* <p>
* This string is identical to the {@linkplain #getStartDelimiter() start delimiter}, except that it does not include the
* initial "<code><</code>" or "<code></</code>" characters that always prefix the start delimiter of a
* {@link StartTagType} or {@link EndTagType} respectively.
* <p>
* The {@linkplain Tag#getName() name} of a tag of this type may or may not include extra characters after the prefix.
* This is determined by properties such as {@link StartTagType#isNameAfterPrefixRequired()}
* or {@link EndTagTypeGenericImplementation#isStatic()}.
* <p>
* <dl>
* <dt>Standard Tag Type Values:</dt>
* <dd>
* <table class="bordered" style="margin: 15px" cellspacing="0">
* <tr><th>Tag Type<th>Name Prefix
* <tr><td>{@link StartTagType#UNREGISTERED}<td><i>(empty string)</i>
* <tr><td>{@link StartTagType#NORMAL}<td><i>(empty string)</i>
* <tr><td>{@link StartTagType#COMMENT}<td><code>!--</code>
* <tr><td>{@link StartTagType#XML_DECLARATION}<td><code>?xml</code>
* <tr><td>{@link StartTagType#XML_PROCESSING_INSTRUCTION}<td><code>?</code>
* <tr><td>{@link StartTagType#DOCTYPE_DECLARATION}<td><code>!doctype</code>
* <tr><td>{@link StartTagType#MARKUP_DECLARATION}<td><code>!</code>
* <tr><td>{@link StartTagType#CDATA_SECTION}<td><code>![cdata[</code>
* <tr><td>{@link StartTagType#SERVER_COMMON}<td><code>%</code>
* <tr><td>{@link EndTagType#UNREGISTERED}<td><i>(empty string)</i>
* <tr><td>{@link EndTagType#NORMAL}<td><i>(empty string)</i>
* </table>
* </dl>
* <dl>
* <dt>Extended Tag Type Values:</dt>
* <dd>
* <table class="bordered" style="margin: 15px" cellspacing="0">
* <tr><th>Tag Type<th>Name Prefix
* <tr><td>{@link MicrosoftTagTypes#DOWNLEVEL_REVEALED_CONDITIONAL_COMMENT}<td><code>![</code>
* <tr><td>{@link PHPTagTypes#PHP_SCRIPT}<td><code>script</code>
* <tr><td>{@link PHPTagTypes#PHP_SHORT}<td><code>?</code>
* <tr><td>{@link PHPTagTypes#PHP_STANDARD}<td><code>?php</code>
* <tr><td>{@link MasonTagTypes#MASON_COMPONENT_CALL}<td><code>&</code>
* <tr><td>{@link MasonTagTypes#MASON_COMPONENT_CALLED_WITH_CONTENT}<td><code>&|</code>
* <tr><td>{@link MasonTagTypes#MASON_COMPONENT_CALLED_WITH_CONTENT_END}<td><code>&</code>
* <tr><td>{@link MasonTagTypes#MASON_NAMED_BLOCK}<td><code>%</code>
* <tr><td>{@link MasonTagTypes#MASON_NAMED_BLOCK_END}<td><code>%</code>
* </table>
* </dl>
*
* @return the {@linkplain Tag#getName() name} prefix required by this tag type.
* @see #getStartDelimiter()
*/
protected final String getNamePrefix() {
return namePrefix;
}
/**
* Indicates whether a tag of this type is valid in the specified position of the specified source document.
* <br />(<a href="TagType.html#ImplementationAssistance">implementation assistance</a> method)
* <p>
* This method is called immediately before {@link #constructTagAt(Source, int pos)}
* to do a preliminary check on the validity of a tag of this type in the specified position.
* <p>
* This check is not performed as part of the {@link #constructTagAt(Source, int pos)} call because the same
* validation is used for all the <a href="TagType.html#Standard">standard</a> tag types, and is likely to be sufficient
* for all <a href="TagType.html#Custom">custom tag types</a>.
* Having this check separated into a different method helps to isolate common code from the code that is unique to each tag type.
* <p>
* In theory, a {@linkplain TagType#isServerTag() server tag} is valid in any position, but a non-server tag is not valid inside any other tag,
* nor inside elements with CDATA content such as {@link HTMLElementName#SCRIPT SCRIPT} and {@link HTMLElementName#STYLE STYLE} elements.
* <p>
* The common implementation of this method always returns <code>true</code> for server tags, but for non-server tags it behaves slightly differently
* depending upon whether or not a {@linkplain Source#fullSequentialParse() full sequential parse} is being peformed.
* <p>
* When this method is called during a full sequential parse, the <code>fullSequentialParseData</code> argument contains information
* allowing the exact theoretical check to be performed, rejecting a non-server tag if it is inside any other tag.
* See below for further information about the <code>fullSequentialParseData</code> parameter.
* <p>
* Prior to Version 2.6, non-server tags were only rejected if they were located inside other non-server tags.
* The current version rejects non-server tags that are located inside any other tag during a full sequential parse.
* <p>
* When this method is called in <a href="Source.html#ParseOnDemand">parse on demand</a> mode
* (not during a full sequential parse, <code>fullSequentialParseData==null</code>),
* practical constraints prevent the exact theoretical check from being carried out, and non-server tags are only rejected
* if they are found inside HTML {@linkplain StartTagType#COMMENT comments} or {@linkplain StartTagType#CDATA_SECTION CDATA sections}.
* <p>
* This behaviour is configurable by manipulating the static {@link TagType#getTagTypesIgnoringEnclosedMarkup() TagTypesIgnoringEnclosedMarkup} array
* to determine which tag types can not contain non-server tags in <a href="Source.html#ParseOnDemand">parse on demand</a> mode.
* The {@linkplain TagType#getTagTypesIgnoringEnclosedMarkup() documentation of this property} contains
* a more detailed analysis of the subject and explains why only the {@linkplain StartTagType#COMMENT comment} and
* {@linkplain StartTagType#CDATA_SECTION CDATA section} tag types are included by default.
* <p>
* See the documentation of the <a href="Tag.html#ParsingProcess">tag parsing process</a> for more information about how this method fits into the whole tag parsing process.
* <p>
* This method can be overridden in <a href="TagType.html#Custom">custom tag types</a> if the default implementation is unsuitable.
* <p>
* <b>The <code>fullSequentialParseData</code> parameter:</b>
* <p>
* This parameter is used to discard non-server tags that are found inside other tags or inside {@link HTMLElementName#SCRIPT SCRIPT} elements.
* <p>
* In the current version of this library, the <code>fullSequentialParseData</code> argument is either <code>null</code>
* (in <a href="Source.html#ParseOnDemand">parse on demand</a> mode) or an integer array containing only a single entry
* (if a {@linkplain Source#fullSequentialParse() full sequential parse} is being peformed).
* <p>
* The integer contained in the array is the maximum position in the document at which the end of a tag has been found,
* indicating that no non-server tags should be recognised before that position.
* If no tags have yet been encountered, the value of this integer is zero.
* <p>
* If the last tag encountered was the {@linkplain StartTag start tag} of a {@link HTMLElementName#SCRIPT SCRIPT} element,
* the value of this integer is <code>Integer.MAX_VALUE</code>, indicating that no other non-server elements should be recognised until the
* {@linkplain EndTag end tag} of the {@link HTMLElementName#SCRIPT SCRIPT} element is found.
* According to the <a target="_blank" href="http://www.w3.org/TR/html401/types.html#idx-CDATA-1">HTML 4.01 specification section 6.2</a>,
* the first occurrence of the character sequence "<code></</code>" terminates the special handling of CDATA within
* {@link HTMLElementName#SCRIPT SCRIPT} and {@link HTMLElementName#STYLE STYLE} elements.
* This library however only terminates the CDATA handling of {@link HTMLElementName#SCRIPT SCRIPT} element content
* when the character sequence "<code></script</code>" is detected, in line with the behaviour of the major browsers.
* <p>
* Note that the implicit treatment of {@link HTMLElementName#SCRIPT SCRIPT} element content as CDATA should theoretically also prevent the recognition of
* {@linkplain StartTagType#COMMENT comments} and explicit {@linkplain StartTagType#CDATA_SECTION CDATA sections} inside script elements.
* While this is true for explicit {@linkplain StartTagType#CDATA_SECTION CDATA sections}, the parser does still recognise
* {@linkplain StartTagType#COMMENT comments} inside {@link HTMLElementName#SCRIPT SCRIPT} elements in order to maintain compatability with the major browsers.
* This prevents the character sequence "<code></script</code>" from terminating the {@link HTMLElementName#SCRIPT SCRIPT} element
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -