| java.lang.Object au.id.jericho.lib.html.Segment au.id.jericho.lib.html.Attribute
Constructor Summary | |
| Attribute(Source source, String key, Segment nameSegment) Constructs a new Attribute with no value part, called from Attributes class. | | Attribute(Source source, String key, Segment nameSegment, Segment valueSegment, Segment valueSegmentIncludingQuotes) Constructs a new Attribute, called from Attributes class.
The resulting Attribute segment begins at the start of the nameSegment
and finishes at the end of the valueSegmentIncludingQuotes. |
Attribute | Attribute(Source source, String key, Segment nameSegment)(Code) | | Constructs a new Attribute with no value part, called from Attributes class.
Note that the resulting Attribute segment has the same span as the supplied nameSegment.
Parameters: source - the Source document. Parameters: key - the name of this attribute in lower case. Parameters: nameSegment - the segment representing the name. |
Attribute | Attribute(Source source, String key, Segment nameSegment, Segment valueSegment, Segment valueSegmentIncludingQuotes)(Code) | | Constructs a new Attribute, called from Attributes class.
The resulting Attribute segment begins at the start of the nameSegment
and finishes at the end of the valueSegmentIncludingQuotes. If this attribute
has no value, it finishes at the end of the nameSegment.
If this attribute has no value, the valueSegment and valueSegmentIncludingQuotes must be null.
The parameter must not be null if the valueSegment is not null, and vice versa
Parameters: source - the Source document. Parameters: key - the name of this attribute in lower case. Parameters: nameSegment - the segment spanning the name. Parameters: valueSegment - the segment spanning the value. Parameters: valueSegmentIncludingQuotes - the segment spanning the value, including quotation marks if any. |
getDebugInfo | public String getDebugInfo()(Code) | | Returns a string representation of this object useful for debugging purposes.
a string representation of this object useful for debugging purposes. |
getKey | public String getKey()(Code) | | Returns the name of this attribute in lower case.
This package treats all attribute names as case insensitive, consistent with
HTML but not consistent with
XHTML.
the name of this attribute in lower case. See Also: Attribute.getName() |
getNameSegment | public Segment getNameSegment()(Code) | | Returns the segment spanning the
of this attribute.
the segment spanning the of this attribute. See Also: Attribute.getName() |
getQuoteChar | public char getQuoteChar()(Code) | | Returns the character used to quote the value.
The return value is either a double-quote (" ), a single-quote (' ), or a space.
the character used to quote the value, or a space if the value is not quoted or this attribute has no value. |
getValue | public String getValue()(Code) | | Returns the
value of this attribute,
or null if it
.
This is equivalent to
CharacterReference .
CharacterReference.decode(CharSequenceboolean) decode (
Attribute.getValueSegment() ,true) .
Note that before version 1.4.1 this method returned the raw value of the attribute as it appears in the source document,
without
.
To obtain the raw value without decoding, use
Attribute.getValueSegment() .toString() .
Special attention should be given to attributes that contain URLs, such as the
href attribute.
When such an attribute contains a URL with parameters (as described in the
form-urlencoded media type),
the ampersand (& ) characters used to separate the parameters should be
to prevent the parameter names from being
unintentionally interpreted as
.
This requirement is explicitly stated in the
HTML 4.01 specification section 5.3.2.
For example, take the following element in the source document:
<a href="Report.jsp?chapt=2§=3">next</a>
By default, calling
Element.getAttributes getAttributes() .
Attributes.getValue(String) getValue ("href")
on this element returns the string
"Report.jsp?chapt=2§=3 ", since the text "§ " is interpreted as the rarely used
character entity reference
CharacterEntityReference._sect § (U+00A7), despite the fact that it is
missing the
(; ).
Most browsers recognise unterminated character entity references
in attribute values representing a codepoint of U+00FF or below, but ignore those representing codepoints above this value.
One relatively popular browser only recognises those representing a codepoint of U+003E or below, meaning it would
have interpreted the URL in the above example differently to most other browsers.
Most browsers also use different rules depending on whether the unterminated character reference is inside or outside
of an attribute value, with both of these possibilities further split into different rules for
,
decimal character references, and
hexadecimal character references.
The behaviour of this library is determined by the current
setting,
which is determined by the
Config.CurrentCompatibilityMode property.
the value of this attribute, or null if it . |
getValueSegment | public Segment getValueSegment()(Code) | | Returns the segment spanning the
of this attribute, or null if it
.
the segment spanning the of this attribute, or null if it . See Also: Attribute.getValue() |
getValueSegmentIncludingQuotes | public Segment getValueSegmentIncludingQuotes()(Code) | | Returns the segment spanning the
of this attribute, including quotation marks if any,
or null if it
.
If the value is not enclosed by quotation marks, this is the same as the
the segment spanning the of this attribute, including quotation marks if any, or null if it . |
hasValue | public boolean hasValue()(Code) | | Indicates whether this attribute has a value.
This method also returns true if this attribute has been assigned a zero-length value.
It only returns false if this attribute appears in
minimized form.
true if this attribute has a value, otherwise false . |
|
|