public class StartTagTypeGenericImplementation extends StartTagType
StartTagType class based on the most common start tag behaviour.
This class is only of interest to users who wish to create custom tag types.
The only external difference between this class and its abstract superclass StartTagType is that it provides a default
implementation of the constructTagAt(Source, int pos) method.
Most of the predefined start tag types are implemented using this class or a subclass of it.
EndTagTypeGenericImplementationCDATA_SECTION, COMMENT, DOCTYPE_DECLARATION, MARKUP_DECLARATION, NORMAL, SERVER_COMMON, SERVER_COMMON_COMMENT, SERVER_COMMON_ESCAPED, UNREGISTERED, XML_DECLARATION, XML_PROCESSING_INSTRUCTION| Modifier | Constructor and Description |
|---|---|
protected |
StartTagTypeGenericImplementation(java.lang.String description,
java.lang.String startDelimiter,
java.lang.String closingDelimiter,
EndTagType correspondingEndTagType,
boolean isServerTag)
Constructs a new
StartTagTypeGenericImplementation object with the specified properties. |
protected |
StartTagTypeGenericImplementation(java.lang.String description,
java.lang.String startDelimiter,
java.lang.String closingDelimiter,
EndTagType correspondingEndTagType,
boolean isServerTag,
boolean hasAttributes,
boolean isNameAfterPrefixRequired)
Constructs a new
StartTagTypeGenericImplementation object with the specified properties. |
| Modifier and Type | Method and Description |
|---|---|
protected Tag |
constructTagAt(Source source,
int pos)
Constructs a tag of this type at the specified position in the specified source document if it matches all of the required features.
|
protected int |
getEnd(Source source,
int pos)
Returns the end of a tag of this type, starting from the specified position in the specified source document.
|
atEndOfAttributes, constructStartTag, getCorrespondingEndTagType, hasAttributes, isNameAfterPrefixRequired, parseAttributesderegister, getClosingDelimiter, getDescription, getNamePrefix, getRegisteredTagTypes, getStartDelimiter, getTagTypesIgnoringEnclosedMarkup, isServerTag, isValidPosition, register, setTagTypesIgnoringEnclosedMarkup, tagEncloses, toStringprotected StartTagTypeGenericImplementation(java.lang.String description,
java.lang.String startDelimiter,
java.lang.String closingDelimiter,
EndTagType correspondingEndTagType,
boolean isServerTag)
StartTagTypeGenericImplementation object with the specified properties.
This is equivalent to calling
new StartTagTypeGenericImplementation(description,startDelimiter,closingDelimiter,correspondingEndTagType,isServerTag,false,false).
description - a description of the new start tag type useful for debugging purposes.startDelimiter - the start delimiter of the new start tag type.closingDelimiter - the closing delimiter of the new start tag type.correspondingEndTagType - the corresponding end tag type of the new start tag type.isServerTag - indicates whether the new start tag type is a server tag.protected StartTagTypeGenericImplementation(java.lang.String description,
java.lang.String startDelimiter,
java.lang.String closingDelimiter,
EndTagType correspondingEndTagType,
boolean isServerTag,
boolean hasAttributes,
boolean isNameAfterPrefixRequired)
StartTagTypeGenericImplementation object with the specified properties.
description - a description of the new start tag type useful for debugging purposes.startDelimiter - the start delimiter of the new start tag type.closingDelimiter - the closing delimiter of the new start tag type.correspondingEndTagType - the corresponding end tag type of the new start tag type.isServerTag - indicates whether the new start tag type is a server tag.hasAttributes - indicates whether the new start tag type has attributes.isNameAfterPrefixRequired - indicates whether a name is required after the prefix.protected Tag constructTagAt(Source source, int pos)
This default implementation performs the following steps:
Source.getNameEnd(int pos) method.
If one is found, set the name to include it, otherwise return null.
null.
<?xmlt ?>" should not be recognised as an
XML processing instruction, which has the prefix "<?xml".
parseAttributes(source,pos,name) to parse them.
Return null if too many errors occur while parsing the attributes.
getEnd(Source, int pos) method,
where pos is either the end of the attributes segment or the end of the
name depending on whether the tag type has attributes.
Return null if the end of the tag can not be found.
StartTag object using the
constructStartTag(Source, int pos, int end, String name, Attributes)
method with the argument values collected over the previous steps.
See TagType.constructTagAt(Source, int pos) for more important information about this method.
constructTagAt in class TagTypesource - the Source document.pos - the position in the source document.null if it does not meet the criteria.protected int getEnd(Source source, int pos)
This default implementation simply searches for the first occurrence of the closing delimiter after the specified position, and returns the position immediately after the end of it.
If the closing delimiter is not found, the value -1 is returned.