All Downloads are FREE. Search and download functionalities are using the official Maven repository.

doc.api.au.id.jericho.lib.html.Attribute.html Maven / Gradle / Ivy

Go to download

Jericho HTML Parser is a simple but powerful java library allowing analysis and manipulation of parts of an HTML document, including some common server-side tags, while reproducing verbatim any unrecognised or invalid HTML. It also provides high-level HTML form manipulation functions.

There is a newer version: 2.3
Show newest version






Attribute (Jericho HTML Parser 1.5-dev1)

















au.id.jericho.lib.html
Class Attribute

java.lang.Object
  extended byau.id.jericho.lib.html.Segment
      extended byau.id.jericho.lib.html.Attribute
All Implemented Interfaces:
java.lang.CharSequence, java.lang.Comparable

public final class Attribute
extends Segment

Represents a single attribute name/value segment within a StartTag.

The methods in this class provide read-only access to a single attribute in the source document. The AttributesOutputSegment class provides a means to add, delete or modify attributes and their values for inclusion in an OutputDocument.

Created using the Attributes.get(String key) method.

See also the XML 1.0 specification for attributes.

See Also:
Attributes

Method Summary
 java.lang.String getDebugInfo()
          Returns a string representation of this object useful for debugging purposes.
 java.lang.String getKey()
          Name of the attribute in lower case.
 java.lang.String getName()
          Returns the name of the attribute in original case.
 Segment getNameSegment()
          Segment spanning the Name of the attribute.
 char getQuoteChar()
          Returns the character used to quote the value.
 java.lang.String getValue()
          Returns the decoded value of the attribute.
 Segment getValueSegment()
          Segment spanning the Value of the attribute.
 Segment getValueSegmentIncludingQuotes()
          Segment spanning the value of the attribute, including quotation marks if any.
 boolean hasValue()
          Indicates whether the attribute has a value.
 
Methods inherited from class au.id.jericho.lib.html.Segment
charAt, compareTo, encloses, encloses, equals, findAllCharacterReferences, findAllComments, findAllElements, findAllElements, findAllStartTags, findAllStartTags, findAllStartTags, findFormControls, findFormFields, findWords, getBegin, getEnd, getSourceText, getSourceTextNoWhitespace, hashCode, ignoreWhenParsing, isComment, isWhiteSpace, length, parseAttributes, subSequence, toString
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

getKey

public java.lang.String getKey()
Name of the attribute in lower case.

Note that this package treats all attribute names as case in-sensitive, contrary to the XHTML specification.


getNameSegment

public Segment getNameSegment()
Segment spanning the Name of the attribute.


getValueSegment

public Segment getValueSegment()
Segment spanning the Value of the attribute.


getValueSegmentIncludingQuotes

public Segment getValueSegmentIncludingQuotes()
Segment spanning the value of the attribute, including quotation marks if any.

If the value is not enclosed by quotation marks, this is the same as the value segment


getQuoteChar

public char getQuoteChar()
Returns the character used to quote the value.

This will be either a double-quote (") or a single-quote (').

Returns:
the character used to quote the value, or a space if the value is not quoted or the attribute has no value.

getName

public java.lang.String getName()
Returns the name of the attribute in original case.

Returns:
the name of the attribute in original case.

getValue

public java.lang.String getValue()
Returns the decoded value of the attribute.

Note that before version 1.5 this method returned the raw value of the attribute, without decoding.

Returns:
the decoded value of the attribute, or null if the attribute has no value.

hasValue

public boolean hasValue()
Indicates whether the attribute has a value.

Returns:
true if the attribute has a value, otherwise false.

getDebugInfo

public java.lang.String getDebugInfo()
Description copied from class: Segment
Returns a string representation of this object useful for debugging purposes.

Overrides:
getDebugInfo in class Segment
Returns:
a string representation of this object useful for debugging purposes.






© 2015 - 2024 Weber Informatics LLC | Privacy Policy