Take the following HTML segment as an example:
<p>This is a sample paragraph.</p>
The "<p>
" is represented by a {@link StartTag} object, and the "</p>
" is represented by an {@link EndTag} object,both of which are subclasses of the Tag
class. The whole segment, including the start tag, its corresponding end tag and all of the content in between, is represented by an {@link Element} object.
<
' character found in the source document is considered to be the start of a tag. The characters following it are compared with the {@linkplain TagType#getStartDelimiter() start delimiters}of all the {@linkplain TagType#register() registered} {@linkplain TagType tag types}, and a list of matching tag types is determined. The analysis performed in relation to each candidate tag type is a two-stage process:
The {@link TagType#isValidPosition(Source, int pos, int[] fullSequentialParseData)} method is responsible for this checkand has a common default implementation for all tag types (although custom tag types can override it if necessary). Its behaviour differs depending on whether or not a {@linkplain Source#fullSequentialParse() full sequential parse} is peformed.See the documentation of the {@link TagType#isValidPosition(Source,int,int[]) isValidPosition} method for full details.
null
and the process continues with the next candidate tag type. >
' character is taken to be an {@linkplain #isUnregistered() unregistered} tag.Some tag search methods ignore unregistered tags. See the {@link #isUnregistered()} method for more information.See the documentation of the {@link TagType} class for more details on how tags are recognised.
Methods that get tags in a source document are collectively referred to as Tag Search Methods. They are found mostly in the {@link Source} and {@link Segment} classes, and can be generally categorised as follows:
name
which is used to specify the {@linkplain #getName() name} of the tag to search for.Specifying a name that ends in a colon (:
) searches for all elements or tags in the specified XML namespace. tagType
which is used to specify the {@linkplain #getTagType() type} of the tag to search for.In some methods the search parameter is restricted to the {@link StartTagType} or {@link EndTagType} subclass of TagType
.
|
|
|
|
|
|
|
|
|
|
|
|