📄 starttagtype.java
字号:
* <dd><code><?xml-stylesheet href="standardstyle.css" type="text/css"?></code></dd>
* </dl>
*/
public static final StartTagType XML_PROCESSING_INSTRUCTION=StartTagTypeXMLProcessingInstruction.INSTANCE;
/**
* The tag type given to a <a target="_blank" href="http://www.w3.org/TR/html401/struct/global.html#h-7.2">document type declaration</a>
* (<code><!DOCTYPE<var> ... </var>></code>).
* <p>
* Information about the document type declaration can be found in the
* <a target="_blank" href="http://www.w3.org/TR/html401/struct/global.html#h-7.2">HTML 4.01 specification section 7.2</a>, and the
* <a target="_blank" href="http://www.w3.org/TR/REC-xml#dt-doctype">XML 1.0 specification section 2.8</a>.
* <p>
* The "<code>!DOCTYPE</code>" tag name is required to be in upper case in the source document,
* but all tag properties are stored in lower case because this library performs all parsing in lower case.
* <p>
* <dl>
* <dt>Properties:</dt>
* <dd>
* <table class="bordered" style="margin: 15px" cellspacing="0">
* <tr><th>Property<th>Value
* <tr><td>{@link #getDescription() Description}<td>document type declaration
* <tr><td>{@link #getStartDelimiter() StartDelimiter}<td><code><!doctype</code>
* <tr><td>{@link #getClosingDelimiter() ClosingDelimiter}<td><code>></code>
* <tr><td>{@link #isServerTag() IsServerTag}<td><code>false</code>
* <tr><td>{@link #getNamePrefix() NamePrefix}<td><code>!doctype</code>
* <tr><td>{@link #getCorrespondingEndTagType() CorrespondingEndTagType}<td><code>null</code>
* <tr><td>{@link #hasAttributes() HasAttributes}<td><code>false</code>
* <tr><td>{@link #isNameAfterPrefixRequired() IsNameAfterPrefixRequired}<td><code>false</code>
* </table>
* <dt>Example:</dt>
* <dd><code><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"></code></dd>
* </dl>
*/
public static final StartTagType DOCTYPE_DECLARATION=StartTagTypeDoctypeDeclaration.INSTANCE;
/**
* The tag type given to a <a target="_blank" href="http://www.w3.org/TR/REC-xml/#dt-markupdecl">markup declaration</a>
* (<code><!ELEMENT<var> ... </var>></code> | <code><!ATTLIST<var> ... </var>></code> | <code><!ENTITY<var> ... </var>></code> | <code><!NOTATION<var> ... </var>></code>).
* <p>
* The {@linkplain Tag#getName() name} of a markup declaration tag is must be one of
* "<code>!element</code>", "<code>!attlist</code>", "<code>!entity</code>" or "<code>!notation</code>".
* These tag names are required to be in upper case in the source document,
* but all tag properties are stored in lower case because this library performs all parsing in lower case.
* <p>
* Markup declarations usually appear inside a
* <a target="_blank" href="http://www.w3.org/TR/REC-xml#dt-doctype">document type definition</a> (DTD), which is usually an external
* document to the HTML or XML document, but they can also appear directly within the
* {@linkplain #DOCTYPE_DECLARATION document type declaration} which is why they must be recognised by the parser.
* <p>
* <dl>
* <dt>Properties:</dt>
* <dd>
* <table class="bordered" style="margin: 15px" cellspacing="0">
* <tr><th>Property<th>Value
* <tr><td>{@link #getDescription() Description}<td>markup declaration
* <tr><td>{@link #getStartDelimiter() StartDelimiter}<td><code><!</code>
* <tr><td>{@link #getClosingDelimiter() ClosingDelimiter}<td><code>></code>
* <tr><td>{@link #isServerTag() IsServerTag}<td><code>false</code>
* <tr><td>{@link #getNamePrefix() NamePrefix}<td><code>!</code>
* <tr><td>{@link #getCorrespondingEndTagType() CorrespondingEndTagType}<td><code>null</code>
* <tr><td>{@link #hasAttributes() HasAttributes}<td><code>false</code>
* <tr><td>{@link #isNameAfterPrefixRequired() IsNameAfterPrefixRequired}<td><code>true</code>
* </table>
* <dt>Example:</dt>
* <dd><code><!ELEMENT BODY O O (%flow;)* +(INS|DEL) -- document body --></code></dd>
* </dl>
*/
public static final StartTagType MARKUP_DECLARATION=StartTagTypeMarkupDeclaration.INSTANCE;
/**
* The tag type given to a <a target="_blank" href="http://www.w3.org/TR/html401/appendix/notes.html#h-B.3.5">CDATA section</a>
* (<code><![CDATA[<var> ... </var>]]></code>).
* <p>
* A CDATA section is a specific form of a
* <a target="_blank" href="http://www.w3.org/TR/html401/appendix/notes.html#h-B.3.5">marked section</a>.
* This library does not include a <a href="TagType.html#Predefined">predefined</a> generic tag type for marked sections,
* as the only type of marked sections found in HTML documents are CDATA sections.
* <p>
* The <a target="_blank" href="http://www.w3.org/TR/html401/appendix/notes.html#h-B.3.5">HTML 4.01 specification section B.3.5</a>
* and the <a target="_blank" href="http://www.w3.org/TR/REC-xml/#sec-cdata-sect">XML 1.0 specification section 2.7</a>
* contain definitions for a CDATA section.
* <p>
* There is inconsistency between the SGML and HTML/XML specifications in the definition of a marked section.
* SGML requires the presence of a space between the "<code><![</code>" prefix and the keyword, and allows a space after the keyword.
* The XML specification forbids these spaces, and the examples given in the HTML specification do not include them either.
* This library only recognises CDATA sections that do not include the spaces.
* <p>
* The "<code>![CDATA[</code>" tag name is required to be in upper case in the source document according to the HTML/XML specifications,
* but all tag properties are stored in lower case because this makes it more efficient for the library to perform case-insensitive
* parsing of all tags.
* <p>
* In the default configuration, any non-{@linkplain #isServerTag() server} tag appearing within a CDATA section is ignored
* by the parser.
* See the documentation of the <a href="Tag.html#ParsingProcess">tag parsing process</a> for more information.
* <p>
* <dl>
* <dt>Properties:</dt>
* <dd>
* <table class="bordered" style="margin: 15px" cellspacing="0">
* <tr><th>Property<th>Value
* <tr><td>{@link #getDescription() Description}<td>CDATA section
* <tr><td>{@link #getStartDelimiter() StartDelimiter}<td><code><![cdata[</code>
* <tr><td>{@link #getClosingDelimiter() ClosingDelimiter}<td><code>]]></code>
* <tr><td>{@link #isServerTag() IsServerTag}<td><code>false</code>
* <tr><td>{@link #getNamePrefix() NamePrefix}<td><code>![cdata[</code>
* <tr><td>{@link #getCorrespondingEndTagType() CorrespondingEndTagType}<td><code>null</code>
* <tr><td>{@link #hasAttributes() HasAttributes}<td><code>false</code>
* <tr><td>{@link #isNameAfterPrefixRequired() IsNameAfterPrefixRequired}<td><code>false</code>
* </table>
* <dt>Example:</dt>
* <dd>This example shows the recommended practice of enclosing scripts inside a CDATA section:
* <div style="margin-top: 0.5em">
* <pre><script type="text/javascript"><br /> //<![CDATA[<br /> function min(a,b) {return a<b ? a : b;}<br /> //]]><br /></script></pre>
* </div>
* </dl>
*/
public static final StartTagType CDATA_SECTION=StartTagTypeCDATASection.INSTANCE;
/**
* The tag type given to a common server tag
* (<code><%<var> ... </var>%></code>).
* <p>
* Common server tags include
* <a target="_blank" href="http://msdn.microsoft.com/asp/">ASP</a>,
* <a target="_blank" href="http://java.sun.com/products/jsp/">JSP</a>,
* <a target="_blank" href="http://www.modpython.org/">PSP</a>,
* <a target="_blank" href="http://au2.php.net/manual/en/configuration.directives.php#ini.asp-tags">ASP-style PHP</a>,
* <a target="_blank" href="http://www.rubycentral.com/book/web.html#S2">eRuby</a>, and
* <a target="_blank" href="http://www.masonbook.com/book/chapter-2.mhtml#CHP-2-SECT-3.1">Mason substitution</a> tags.
* <p>
* This tag and the {@linkplain #SERVER_COMMON_ESCAPED escaped common server tag} are the only <a href="TagType.html#Standard">standard</a> tag types
* that define {@linkplain #isServerTag() server tags}.
* They are included as standard tag types because of the common server tag's widespread use in many platforms, including those listed above.
* <p>
* <dl>
* <dt>Properties:</dt>
* <dd>
* <table class="bordered" style="margin: 15px" cellspacing="0">
* <tr><th>Property<th>Value
* <tr><td>{@link #getDescription() Description}<td>common server tag
* <tr><td>{@link #getStartDelimiter() StartDelimiter}<td><code><%</code>
* <tr><td>{@link #getClosingDelimiter() ClosingDelimiter}<td><code>%></code>
* <tr><td>{@link #isServerTag() IsServerTag}<td><code>true</code>
* <tr><td>{@link #getNamePrefix() NamePrefix}<td><code>%</code>
* <tr><td>{@link #getCorrespondingEndTagType() CorrespondingEndTagType}<td><code>null</code>
* <tr><td>{@link #hasAttributes() HasAttributes}<td><code>false</code>
* <tr><td>{@link #isNameAfterPrefixRequired() IsNameAfterPrefixRequired}<td><code>false</code>
* </table>
* <dt>Example:</dt>
* <dd><code><%@ include file="header.html" %></code></dd>
* </dl>
*/
public static final StartTagType SERVER_COMMON=StartTagTypeServerCommon.INSTANCE;
/**
* The tag type given to an escaped common server tag
* (<code><\%<var> ... </var>%></code>).
* <p>
* Some of the platforms that support the {@linkplain #SERVER_COMMON common server tag} also support a mechanism to escape that tag by adding a
* backslash (<code>\</code>) before the percent (<code>%</code>) character.
* Although rarely used, this tag type allows the parser to recognise these escaped tags in addition to the common server tag itself.
* <p>
* <dl>
* <dt>Properties:</dt>
* <dd>
* <table class="bordered" style="margin: 15px" cellspacing="0">
* <tr><th>Property<th>Value
* <tr><td>{@link #getDescription() Description}<td>escaped common server tag
* <tr><td>{@link #getStartDelimiter() StartDelimiter}<td><code><\%</code>
* <tr><td>{@link #getClosingDelimiter() ClosingDelimiter}<td><code>%></code>
* <tr><td>{@link #isServerTag() IsServerTag}<td><code>true</code>
* <tr><td>{@link #getNamePrefix() NamePrefix}<td><code>\%</code>
* <tr><td>{@link #getCorrespondingEndTagType() CorrespondingEndTagType}<td><code>null</code>
* <tr><td>{@link #hasAttributes() HasAttributes}<td><code>false</code>
* <tr><td>{@link #isNameAfterPrefixRequired() IsNameAfterPrefixRequired}<td><code>false</code>
* </table>
* <dt>Example:</dt>
* <dd><code><\%@ include file="header.html" %></code></dd>
* </dl>
*/
public static final StartTagType SERVER_COMMON_ESCAPED=StartTagTypeServerCommonEscaped.INSTANCE;
/**
* Constructs a new <code>StartTagType</code> object with the specified properties.
* <br />(<a href="TagType.html#ImplementationAssistance">implementation assistance</a> method)
* <p>
* As <code>StartTagType</code> is an abstract class, this constructor is only called from sub-class constructors.
*
* @param description a {@linkplain #getDescription() description} of the new start tag type useful for debugging purposes.
* @param startDelimiter the {@linkplain #getStartDelimiter() start delimiter} of the new start tag type.
* @param closingDelimiter the {@linkplain #getClosingDelimiter() closing delimiter} of the new start tag type.
* @param correspondingEndTagType the {@linkplain #getCorrespondingEndTagType() corresponding end tag type} of the new start tag type.
* @param isServerTag indicates whether the new start tag type is a {@linkplain #isServerTag() server tag}.
* @param hasAttributes indicates whether the new start tag type {@linkplain #hasAttributes() has attributes}.
* @param isNameAfterPrefixRequired indicates whether a {@linkplain #isNameAfterPrefixRequired() name is required after the prefix}.
*/
protected StartTagType(final String description, final String startDelimiter, final String closingDelimiter, final EndTagType correspondingEndTagType, final boolean isServerTag, final boolean hasAttributes, final boolean isNameAfterPrefixRequired) {
super(description,startDelimiter.toLowerCase(),closingDelimiter,isServerTag,START_DELIMITER_PREFIX);
if (!getStartDelimiter().startsWith(START_DELIMITER_PREFIX)) throw new IllegalArgumentException("startDelimiter of a start tag must start with \""+START_DELIMITER_PREFIX+'"');
this.correspondingEndTagType=correspondingEndTagType;
this.hasAttributes=hasAttributes;
this.isNameAfterPrefixRequired=isNameAfterPrefixRequired;
}
/**
* Returns the {@linkplain EndTagType type} of {@linkplain EndTag end tag} required to pair with a
* {@linkplain StartTag start tag} of this type to form an {@linkplain Element element}.
* <br />(<a href="TagType.html#Property">property</a> method)
* <p>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -