|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object edu.utexas.its.eis.tools.qwicap.template.css.Results
public final class Results
The Results
class exists to store references to the XML markup elements selected by
CSS2 pattern searches, as well as references to the
markup elements affected by the various operations that modify XML markup, such as the insert, delete, and
duplicate operations which Results
supplies. These references are referred to as "matches" and are
represented by instances of the Match
class. A Results
object may contain any number of
matches, including none. Every operation that can be performed on XML markup has a corresponding method in the
Results
class. Whenever such a method is invoked, the operation is individually applied to every
match in that Results
object. In cases where an operation can't logically be applied to some matches,
the operation fails silenty and leaves untouched the markup referenced by those matches. Almost all operations
return a new Results
object containing matches relevant to the operation that was performed, so method
chaining is not only possible, but very powerful.
Search Oriented Methods:
XML Element Oriented Methods:
add(boolean, Object)
addAfter(Object)
addBefore(Object)
copy()
cut()
delete()
duplicate(boolean)
duplicateAfter()
duplicateBefore()
extract()
extractToMarkup()
getAncestors()
getCDATA()
getComments()
getDeclarations()
getParent()
getType()
replace(java.lang.Object)
toForm()
toMarkup()
XML Element Content Oriented Methods:
addContent(boolean, Object)
addToStartOfContent(Object)
addToEndOfContent(Object)
deleteContent()
getBigDecimal()
getBigInteger()
getBoolean()
getByte()
getContent()
getDouble()
getFloat()
getInt()
getLong()
getShort()
getText()
setContent(Object)
setContents(Object...)
XML Element Attribute Oriented Methods:
addAttribute(String, Object)
deleteAttribute(String)
getAttribute(String)
setAttribute(String, Object)
setAttributes(Object...)
updateAttribute(String, Object)
XML Element "class" Attribute Oriented Methods:
Filtering Operations on Results Objects:
Logical Operations on Pairs of Results Objects:
Method Invocation Chain Manipulation Methods:
Building, Exploring, and Clearing Results Objects:
addMatch(Match)
addResults(Results)
addToResults(Results)
clear()
get(int)
isEmpty()
iterator()
notEmpty()
nth(int)
size()
toString()
Constructor Summary | |
---|---|
Results()
Instantiates an empty Results object. |
|
Results(Results PrevResults)
Instantiates an empty Results object, which includes a reference to another "previous"
Results object from which this Results object was, presumably, derived. |
Method Summary | |
---|---|
Results |
add(boolean AddBefore,
Object NewStuff)
Inserts new material before, or after, each XML element referenced by the matches in this Results
object. |
Results |
add(Match AMatch)
Deprecated. Use addMatch instead. |
Results |
add(Results SomeResults)
Deprecated. Use addResults instead. |
Results |
addAfter(Object NewStuff)
Adds new material after each XML element referenced by the matches in this Results object. |
Results |
addAttribute(String AttrName,
Object AttrValue)
Adds an attribute to all of the applicable XML elements referenced by the matches in this Results
object. |
Results |
addBefore(Object NewStuff)
Adds new material before each XML element referenced by the matches in this Results object. |
Results |
addClass(String ClassList)
Adds one or more CSS class names to the "class" attribute of all of the applicable XML elements referenced by the matches in this Results object. |
Results |
addContent(boolean InsertBeforeExistingContent,
Object AdditionalContent)
Adds to the content of each XML element referenced by the matches in this Results object. |
Results |
addContentAfter(Object AdditionalContent)
Deprecated. Use addToEndOfContent instead. |
Results |
addContentAtEnd(Object AdditionalContent)
Deprecated. Use addToEndOfContent instead. |
Results |
addContentAtStart(Object AdditionalContent)
Deprecated. Use addToStartOfContent instead. |
Results |
addContentBefore(Object AdditionalContent)
Deprecated. Use addToStartOfContent instead. |
Results |
addMatch(Match AMatch)
Appends a Match to this Results object. |
Results |
addResults(Results SomeResults)
Appends all of the matches in another Results object to this object. |
Results |
addTo(Results SomeResults)
Deprecated. Use addToResults instead. |
Results |
addToEndOfContent(Object AdditionalContent)
Adds new material to the end of the content of each XML element referenced by the matches in this Results object. |
Results |
addToResults(Results SomeResults)
Appends all of the matches in this Results object to another Results object. |
Results |
addToStartOfContent(Object AdditionalContent)
Adds new material at the start of the content of each XML element referenced by the matches in this Results object. |
Results |
and()
Creates a new Results object containing all of the matches that are common to this
Results object, and the previous Results object (as returned by pop() ). |
Results |
and(Results B)
Creates a new Results object containing all of the matches that are common to this
Results object, and the supplied Results object, "B". |
Results |
clear()
Removes all matches from this Results object. |
ImmutableMarkup |
copy()
Creates a copy of all of the markup represented by the matches (and any children they may have) in this Results object. |
ImmutableMarkup |
cut()
Removes all of the markup represented by the matches (and any children they may have) in this Results
object, and returns it in a new ImmutableMarkup object. |
Results |
delete()
Deletes each XML element (and any associated children) referenced by the matches in this Results
object. |
Results |
deleteAttribute(String AttrName)
Deletes the specified attribute from all of the applicable XML elements referenced by the matches in this Results object. |
Results |
deleteClass(String ClassList)
Removes one or more CSS class names from the "class" attribute of all of the applicable XML elements referenced by the matches in this Results object. |
Results |
deleteContent()
Deletes the contents of each XML element referenced by the matches in this Results object. |
Results |
distinct()
Returns a new Results object which eliminates any redundant element references that may have been
present in this Results object. |
Results |
duplicate(boolean InsertDuplicateBefore)
Duplicates each XML element referenced by the matches in this Results object, and places the
duplicate immediately before, or after, the referenced element. |
Results |
duplicateAfter()
Duplicates each XML element referenced by the matches in this Results object, and places the
duplicate immediately after the referenced element. |
Results |
duplicateBefore()
Duplicates each XML element referenced by the matches in this Results object, and places the
duplicate immediately before the referenced element. |
Results |
ELSE()
Returns an empty Results object if the preceding IF invocation was passed
true , and otherwise returns a Results object that is the same as the Results
object on which the IF was invoked. |
Results |
ENDIF()
Returns the Results object on which IF was invoked. |
ResultsEnumerator |
enumerate()
Deprecated. Use iterator() instead. |
Results |
even()
Returns every even-numbered Match in this Results object, beginning with the first
Match (element 0). |
Results |
everyNth(int GroupSize,
int GroupIndex)
Conceptually divides the matches in this Results object into groups of a certain size, then returns
a new Results object containing the Nth match from each group. |
Results |
extract()
Moves all of the XML elements (children included) referenced by the matches in this Results object
into a new MutableMarkup object, then returns a new Results object containing references
to those elements in their new home. |
MutableMarkup |
extractToMarkup()
Moves all of the XML elements (children included) referenced by the matches in this Results object
into a new MutableMarkup object. |
Results |
first()
Returns the first Match in this Results object as the sole element of a new
Results object. |
Results |
get(CSSPatterns Patterns)
Applies one or more CSS2 selector patterns to the subsections of XML referenced by the matches in this Results object. |
Match |
get(int Index)
Returns the Match at the specified index in this Results object. |
Results |
get(String CSSPatternsStr)
Applies one or more CSS2 selector pattern strings to the subsections of XML referenced by the matches in this Results object. |
Results |
getAncestors()
Returns a complete list of the ancestors of each element referenced by the matches in this Results
object. |
String |
getAttribute(String AttrName)
Returns the value of the specified attribute from the first match in this Results object. |
BigDecimal |
getBigDecimal()
Invokes getText() and converts the String it returns into a BigDecimal , if possible. |
BigInteger |
getBigInteger()
Invokes getText() and converts the String it returns into a BigInteger , if possible. |
boolean |
getBoolean()
Invokes getText() and converts the String it returns into a boolean , if possible. |
byte |
getByte()
Invokes getText() and converts the String it returns into a byte , if possible. |
Results |
getCDATA()
Returns a new Results object listing all of the CDATA (<![CDATA[ … ]]>)
elements in the subsections of XML referenced by the matches in this Results object. |
Results |
getComments()
Returns a new Results object listing all of the comment (<!-- … -->)
elements in this markup. |
Results |
getContent()
Returns a new Results object that references every child of every element referenced by this
Results object. |
Results |
getDeclarations()
Returns a new Results object listing all of the declaration (<! … >)
elements in this markup. |
double |
getDouble()
Invokes getText() and converts the String it returns into a double , if possible. |
float |
getFloat()
Invokes getText() and converts the String it returns into a float , if possible. |
Form |
getForm()
Deprecated. Use toForm() , instead. |
int |
getInt()
Invokes getText() and converts the String it returns into an int , if possible. |
long |
getLong()
Invokes getText() and converts the String it returns into a long , if possible. |
Results |
getParent()
Returns the parent element (if any) of each element referenced by the matches in this Results object. |
short |
getShort()
Invokes getText() and converts the String it returns into a short , if possible. |
String |
getText()
Returns the human-readable/-visible text, if any, that the elements referenced by this Results object
would contribute to the final, rendered document. |
String |
getType()
Returns the type of the first XML element in this Results objects. |
Results |
IF_NOT_EMPTY()
If this Results object is not empty, a new Results object is returned that is the same as
this Results object. |
Results |
IF(boolean B)
Tests a boolean parameter: If it's true , a new Results object is returned that is the same
as this Results object; if it's false , an empty Results object is returned. |
Results |
insert(boolean InsertBefore,
Object NewStuff)
Deprecated. Use add instead. |
Results |
insertAfter(Object NewStuff)
Deprecated. Use addAfter instead. |
Results |
insertBefore(Object NewStuff)
Deprecated. Use addBefore instead. |
boolean |
isEmpty()
Returns true if there are no matches in this Results object. |
Iterator<Match> |
iterator()
Returns an Iterator of the matches stored in this Results object. |
Results |
last()
Returns the final Match in this Results object as the sole element of a new
Results object. |
boolean |
notEmpty()
Returns true if there is one, or more, matches in this Results object. |
Results |
nth(int Index)
Returns the Match at the specified index in this Results object (the "Nth"
Match ) as the sole element of a new Results object. |
Results |
odd()
Returns every odd-numbered Match in this Results object, beginning with the second
Match (element 1). |
Results |
or()
Creates a new Results object containing all of the matches that are present in either this
Results object, or the previous Results object (as returned by pop() ). |
Results |
or(Results B)
Creates a new Results object containing all of the matches that are present in either this
Results object, or the supplied Results object, "B". |
Results |
pop()
Returns the Results object, if any, from which this instance was produced. |
Results |
pop(int PopCount)
Returns the Nth Results object in this chain of Results objects; in effect
this invokes the pop method N times and returns the result. |
Results |
print()
Deprecated. Use toString() instead. |
Results |
print(String Prefix)
Deprecated. Use toString() instead. |
Results |
replace(Object Replacement)
Replaces each XML element referenced by the matches in this Results object with the supplied material. |
Results |
setAttribute(String AttrName,
Object AttrValue)
Sets the value of the specified attribute in all of the applicable XML elements referenced by the matches in this Results object. |
Results |
setAttributes(Object... AttrNamesAndValues)
Sets the value of an arbitrary number of specified attributes in all of the applicable XML elements referenced by the matches in this Results object. |
Results |
setClass(String ClassList)
Sets the value of the "class" attribute of all of the applicable XML elements referenced by the matches in this Results object. |
Results |
setContent(Object Value)
Sets the content of each XML element referenced by the matches in this Results object. |
Results |
setContents(Object... SelectorsAndValues)
Searches the content of each XML element referenced by the matches in this Results object using one
or more CSS2 selector patterns, represented as
String or a CSSPatterns object, then sets the content of the matching elements to the
supplied value. |
int |
size()
Returns the number of matches in this Results object. |
Form |
toForm()
Returns a Form object for examining and/or manipulating the first XHTML "form" element
(and the controls within it) that is found in this Results object. |
MutableMarkup |
toMarkup()
Creates a MutableMarkup object containing all of the XML elements (and any associated children)
referenced by the matches in this Results object. |
String |
toString()
Returns a String representation of all of the XML elements (and any associated children) referenced by
the matches in this Results object. |
Results |
updateAttribute(String AttrName,
Object AttrValue)
Sets the value of the specified attribute in all of the applicable XML elements referenced by the matches in this Results object. |
Results |
xor()
Creates a new Results object containing all of the matches that are not common to this
Results object and the previous Results object (as returned by pop() ). |
Results |
xor(Results B)
Creates a new Results object containing all of the matches that are not common to this and the
supplied Results object, "B". |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Results()
Results
object.
public Results(Results PrevResults)
Results
object, which includes a reference to another "previous"
Results
object from which this Results
object was, presumably, derived. The "previous"
Results
object can be explicitly accessed using the pop()
method, and is implicitly utilized
by various unitary operations like and()
, or()
, and xor()
.
PrevResults
- A "previous" Results
object from which this Results
object
was, presumably, derived.Method Detail |
---|
public Iterator<Match> iterator()
Iterator
of the matches stored in this Results
object.
iterator
in interface Iterable<Match>
Iterator
of the matches stored in this Results
object.@Deprecated public ResultsEnumerator enumerate()
iterator()
instead.
Enumeration
of the matches stored in this Results
object.
Enumeration
of the matches stored in this Results
object.public Results pop()
Results
object, if any, from which this instance was produced.
Results
object from which this instance was produced, or null
, if there was no
previous Results
object.public Results pop(int PopCount)
Results
object in this chain of Results
objects; in effect
this invokes the pop
method N times and returns the result.
PopCount
- The number of pop
s to perform.
Results
object in this chain, or null
if there weren't
N Results
objects in the chain.public int size()
Results
object.
Results
object.public Results clear()
Results
object. (The size method will subsequently return zero.)
Results
object, with its contents removed.public boolean isEmpty()
true
if there are no matches in this Results
object.
true
if empty, false
otherwise.public boolean notEmpty()
true
if there is one, or more, matches in this Results
object.
true
if one or more matches, false
if empty.public Results addMatch(Match AMatch)
Match
to this Results
object.
AMatch
- The Match
to be appended to this list.
Results
object.@Deprecated public Results add(Match AMatch)
addMatch
instead.
Match
to this Results
object.
AMatch
- The Match
to be appended to this list.
Results
object.public Results addResults(Results SomeResults)
Results
object to this object.
SomeResults
- The Results
object whose contents should be appended to the contents of this object.
Results
object.@Deprecated public Results add(Results SomeResults)
addResults
instead.
Results
object to this object.
SomeResults
- The Results
object whose contents should be appended to the contents of this object.
Results
object.public Results addToResults(Results SomeResults)
Results
object to another Results
object. This is the
mirror image of addMatch
.
SomeResults
- The Results
object to which this object's contents should be appended.
Results
object.@Deprecated public Results addTo(Results SomeResults)
addToResults
instead.
Results
object to another Results
object. This is the
mirror image of addMatch
.
SomeResults
- The Results
object to which this object's contents should be appended.
Results
object.public Results or()
Results
object containing all of the matches that are present in either this
Results
object, or the previous Results
object (as returned by pop()
). No
Match
will appear more than once in the new Results
object.
Results
object containing all of the matches in this and the previous
Results
objects.public Results or(Results B)
Results
object containing all of the matches that are present in either this
Results
object, or the supplied Results
object, "B". No Match
will appear more
than once in the new Results
object.
B
- The other Results
object.
Results
object containing all of the matches in this Results
object and "B".public Results and()
Results
object containing all of the matches that are common to this
Results
object, and the previous Results
object (as returned by pop()
).
Results
object containing all of the matches common to this and the
previous Results
objects.public Results and(Results B)
Results
object containing all of the matches that are common to this
Results
object, and the supplied Results
object, "B".
B
- The other Results
object.
Results
object containing all of the matches common to this
Results
object and "B".public Results xor()
Results
object containing all of the matches that are not common to this
Results
object and the previous Results
object (as returned by pop()
).
Results
object containing all of the matches not common to this and the
previous Results
objects.public Results xor(Results B)
Results
object containing all of the matches that are not common to this and the
supplied Results
object, "B".
B
- The other Results
object.
Results
object containing all of the matches not common to this and "B".public Results IF(boolean B)
true
, a new Results
object is returned that is the same
as this Results
object; if it's false
, an empty Results
object is returned.
is returned. Note that nesting of IF
, or IF_NOT_EMPTY
, invocations is not supported.
B
- boolean
value to be tested.
true
, a Results
object that is same as this object,
otherwise an empty Results
.public Results IF_NOT_EMPTY()
Results
object is not empty, a new Results
object is returned that is the same as
this Results
object. If this Results
object is empty, an empty Results
object
is returned. Note that nesting of IF
, or IF_NOT_EMPTY
, invocations is not supported.
Results
is not empty, a Results
object that is same as this
object, otherwise an empty Results
.public Results ELSE()
Results
object if the preceding IF
invocation was passed
true
, and otherwise returns a Results
object that is the same as the Results
object on which the IF
was invoked.
IF
tested true
, an empty Results
object,
otherwise a Results
object that is same as the Results
object on which
IF
was invoked.public Results ENDIF()
Results
object on which IF
was invoked.
Results
object on which IF
was invoked.public Match get(int Index)
Match
at the specified index in this Results
object.
Index
- The index number of the desired Match
.
Match
in this Results
object.
ArrayIndexOutOfBoundsException
- If Index is too large or small.nth(int)
,
everyNth(int, int)
,
size()
,
iterator()
public Results get(String CSSPatternsStr)
Results
object.
CSSPatternsStr
- CSS2 selector pattern(s).
Results
object containing matches for each element selected by the CSS2
pattern.public Results getDeclarations()
Results
object listing all of the declaration (<! … >)
elements in this markup.
Results
object containing matches for declaration elements.public Results getComments()
Results
object listing all of the comment (<!-- … -->)
elements in this markup.
Results
object containing matches for comment elements.public Results getCDATA()
Results
object listing all of the CDATA (<![CDATA[ … ]]>)
elements in the subsections of XML referenced by the matches in this Results
object.
Results
object containing matches for CDATA sections.public Results get(CSSPatterns Patterns)
Results
object.
Patterns
- CSS2 selector pattern(s) represented
in their "compiled" form by a CSSPatterns
object.
Results
object containing matches for each element selected by the CSS2 pattern.public Results getAncestors()
Results
object. This is generally useful only when there is a single match in this Results
object.
Results
object containing a list of the ancestors of each element referenced by the
matches in this Results
object. If there is only one element referenced by this
Results
object, the first item in the Results
object that is returned will be
the immediate parent of the element, and the last element will be the most distant ancestor. If there is
more than one element referenced by this Results
object, this method probably isn't useful.public Results getParent()
Results
object.
Results
object containing a reference to the parent element of each element referenced
in this Results
object.@Deprecated public Form getForm()
toForm()
, instead.
Form
object for examining and/or manipulating the XHTML "form" element (and the
controls within it) that is referenced by the first match in this Results
object. If you intend to
modify the "form" element, or its contents, you should already be operating on MutableMarkup
before invoking toForm
. A mutable version of ImmutableMarkup
is created trivially by
merely invoking the Markup.getMutable()
method.
Form
object for manipulating the "form" element
referenced by the first match in this Results
object, or null
if the Results
object is either empty or its first match does not reference
a "form" element.MutableMarkup.getForm(FormDataSet)
public Form toForm() throws FormNotFoundException
Form
object for examining and/or manipulating the first XHTML "form" element
(and the controls within it) that is found in this Results
object. If you intend to
modify the "form" element, or its contents, you should already be operating on MutableMarkup
before invoking toForm
. A mutable version of ImmutableMarkup
is created trivially by
merely invoking the Markup.getMutable()
method.
Form
object for manipulating the first "form" element
found in this Results
object.
FormNotFoundException
- If this Results
object contains no "form" element.MutableMarkup.getForm(FormDataSet)
,
Match.toForm()
public Results distinct()
Results
object which eliminates any redundant element references that may have been
present in this Results
object.
Results
object in which all of the element references are unique.public Results first()
Match
in this Results
object as the sole element of a new
Results
object. If there were no matches in this Results
object, the new
Results
object is empty.
Results
object containing only the first Match
in this Results
object.last()
,
even()
,
odd()
public Results last()
Match
in this Results
object as the sole element of a new
Results
object. If there were no matches in this Results
object, the new
Results
object is empty.
Results
object containing only the final Match
in this Results
object.first()
,
odd()
,
even()
public Results nth(int Index)
Match
at the specified index in this Results
object (the "Nth"
Match
) as the sole element of a new Results
object. If there is no such element in this
Results
object, the new Results
object is empty.
Index
- The index number of the Match
to be returned. (Greater than or equal to zero, less than
size()
.)
Results
object containing the Nth Match
in this
Results
object.get(int)
,
size()
,
everyNth(int, int)
public Results everyNth(int GroupSize, int GroupIndex)
Results
object into groups of a certain size, then returns
a new Results
object containing the Nth match from each group. For example, the even()
convenience method is implemented as everyNth(2, 0)
(return the match at index zero from every group
of 2), and the odd()
method is implemented as everyNth(2, 1)
(return the match at index 1 from
every group of 2).
GroupSize
- The size of the groups into which the matches should be conceptually divided.GroupIndex
- The index of the match within each group of matches that is to be returned.
Results
object containing the requested Match
objects.public Results even()
Match
in this Results
object, beginning with the first
Match
(element 0). If there were no matches in this Results
object, the new
Results
object is empty. This method is useful for doing things like color-coding alternating rows of
a table.
Results
object containing every even-numbered Match
in this
Results
object, beginning with the first Match
.odd()
,
everyNth(int, int)
,
first()
,
last()
public Results odd()
Match
in this Results
object, beginning with the second
Match
(element 1). If there were less than two matches in this Results
object, the new
Results
object is empty. This method is useful for doing things like color-coding alternating rows of
a table.
Results
object containing every odd-numbered Match
in this
Results
object, beginning with the second Match
.even()
,
everyNth(int, int)
,
first()
,
last()
public Results deleteContent() throws TagException
Results
object. For
example, if there were a match for an "h1" element that looked like:
"<h1>War and Peace</h1>", then calling deleteContent
would reduce that "h1" element to: "<h1></h1>". Elements that have no content are not
affected.
Results
object containing all of the matches in this Results
object.
TagException
- If a problem is encountered with the manipulation of the markup.public Results setContent(Object Value) throws TagException
Results
object. For example,
if there were a match for an "h1" element that looked like: "<h1>War and
Peace</h1>", then calling setContent("Crime and Punishment")
would change that
"h1" element to: "<h1>Crime and Punishment</h1>". Elements that have no
content are not affected.
Value
- An object specifying the new content of the elements referenced by this Results
object. Any type of object is potentially suitable, see MutableMarkup.insert
for details.
Results
object containing all of the matches in this Results
object. If you would prefer a Results
that references all of the content that
was just set, follow your invocation of this method with an invocation of
getContent
.
TagException
- If a problem is encountered with the manipulation of the markup.getContent()
public Results setContents(Object... SelectorsAndValues) throws TagException
Results
object using one
or more CSS2 selector patterns, represented as
String
or a CSSPatterns
object, then sets the content of the matching elements to the
supplied value. This is equivalent to repeatedly chaining the method invocations: get(String)
and
setContent(Object)
. The various setContents
methods are handy for doing things like setting
the contents of all of the cells in a table row in one go.
SelectorsAndValues
- An array of alternating CSS2 selector patterns, represented as String
or
CSSPatterns
objects, and objects representing the content that should
replace the existing content of the XML elements that match the preceding CSS2
selector pattern(s). There may be as many such selector/content pairs as desired.
Results
object containing matches for each element whose contents
were set. If you would prefer a Results
that references all of the content
that was just set, follow your invocation of this method with an invocation of
getContent
.
TagException
- If a problem is encountered with the manipulation of the markup.getContent()
public String getType()
Results
objects.
Results
object, or an empty string if
none of the matches refer to XML elements.public String getText()
Results
object
would contribute to the final, rendered document. At present, this does not usually include the text contributed
by "form" elements, and CSS style information (for example "display: none;") is not taken
into account.
Results
object,
or an empty string if there was no such text.public float getFloat() throws NumberFormatException
getText()
and converts the String
it returns into a float
, if possible.
float
.
NumberFormatException
- If the text of this element couldn't be interpreted as a floating-point number.Float.parseFloat(String)
public double getDouble() throws NumberFormatException
getText()
and converts the String
it returns into a double
, if possible.
double
.
NumberFormatException
- If the text of this element couldn't be interpreted as a floating-point number.Double.parseDouble(String)
public BigDecimal getBigDecimal() throws NumberFormatException
getText()
and converts the String
it returns into a BigDecimal
, if possible.
BigDecimal
.
NumberFormatException
- If the text of this element couldn't be interpreted as a BigDecimal
.BigDecimal.BigDecimal(String)
public boolean getBoolean()
getText()
and converts the String
it returns into a boolean
, if possible.
true
if the text of the element was "true" (case insensitive),
false
otherwise.Boolean.valueOf(String)
public byte getByte() throws NumberFormatException
getText()
and converts the String
it returns into a byte
, if possible.
byte
.
NumberFormatException
- If the text of this element couldn't be interpreted as a byte
.Byte.parseByte(String)
public short getShort() throws NumberFormatException
getText()
and converts the String
it returns into a short
, if possible.
short
.
NumberFormatException
- If the text of this element couldn't be interpreted as an short
.Short.parseShort(String)
public int getInt() throws NumberFormatException
getText()
and converts the String
it returns into an int
, if possible.
int
.
NumberFormatException
- If the text of this element couldn't be interpreted as an int
.Integer.parseInt(String)
public long getLong() throws NumberFormatException
getText()
and converts the String
it returns into a long
, if possible.
long
.
NumberFormatException
- If the text of this element couldn't be interpreted as a long
.Long.parseLong(String)
public BigInteger getBigInteger() throws NumberFormatException
getText()
and converts the String
it returns into a BigInteger
, if possible.
BigInteger
.
NumberFormatException
- If the text of this element couldn't be interpreted as a BigInteger
.BigInteger.BigInteger(String)
public Results getContent()
Results
object that references every child of every element referenced by this
Results
object. Note that only children are listed, not grandchildren and further
descendants.
Results
object referencing every child of every element referenced by this
Results
object.setContent(java.lang.Object)
public Results addToStartOfContent(Object AdditionalContent) throws TagException
Results
object.
AdditionalContent
- Any type of object is potentially suitable, see
MutableMarkup.insert
for details.
Results
object containing references to the content that was
added to this markup.
TagException
- If a problem is encountered with the manipulation of the markup.addContent(boolean, Object)
public Results addToEndOfContent(Object AdditionalContent) throws TagException
Results
object.
AdditionalContent
- Any type of object is potentially suitable, see
MutableMarkup.insert
for details.
Results
object containing references to the content that was
added to this markup.
TagException
- If a problem is encountered with the manipulation of the markup.addContent(boolean, Object)
@Deprecated public Results addContentAtStart(Object AdditionalContent) throws TagException
addToStartOfContent
instead.
Results
object.
AdditionalContent
- Any type of object is potentially suitable, see
MutableMarkup.insert
for details.
Results
object containing references to the content that was
added to this markup.
TagException
- If a problem is encountered with the manipulation of the markup.@Deprecated public Results addContentAtEnd(Object AdditionalContent) throws TagException
addToEndOfContent
instead.
Results
object.
AdditionalContent
- Any type of object is potentially suitable, see
MutableMarkup.insert
for details.
Results
object containing references to the content that was
added to this markup.
TagException
- If a problem is encountered with the manipulation of the markup.@Deprecated public Results addContentBefore(Object AdditionalContent) throws TagException
addToStartOfContent
instead.
Results
object.
AdditionalContent
- Any type of object is potentially suitable, see
MutableMarkup.insert
for details.
Results
object containing references to the content that was
added to this markup.
TagException
- If a problem is encountered with the manipulation of the markup.@Deprecated public Results addContentAfter(Object AdditionalContent) throws TagException
addToEndOfContent
instead.
Results
object.
AdditionalContent
- Any type of object is potentially suitable, see
MutableMarkup.insert
for details.
Results
object containing references to the content that was
added to this markup.
TagException
- If a problem is encountered with the manipulation of the markup.public Results addContent(boolean InsertBeforeExistingContent, Object AdditionalContent) throws TagException
Results
object. For
example, if there were a match for an "h1" element that looked like:
"<h1>The Histories</h1>", then calling addContent(false, " by Herodotus")
would change that "h1" element to: "<h1>The Histories by Herodotus</h1>".
InsertBeforeExistingContent
- true
to insert before the start of the existing content,
false
to insert after it.AdditionalContent
- Any type of object is potentially suitable, see
MutableMarkup.insert
for details.
Results
object containing references to the content that was
added to this markup.
TagException
- If a problem is encountered with the manipulation of the markup.addToStartOfContent(Object)
,
addToEndOfContent(Object)
public Results duplicateBefore() throws TagException
Results
object, and places the
duplicate immediately before the referenced element. The children, if any, of those elements are also duplicated.
Results
object that references each duplicate.
TagException
- If a problem is encountered with the manipulation of the markup.public Results duplicateAfter() throws TagException
Results
object, and places the
duplicate immediately after the referenced element. The children, if any, of those elements are also duplicated.
Results
object that references each duplicate.
TagException
- If a problem is encountered with the manipulation of the markup.public Results duplicate(boolean InsertDuplicateBefore) throws TagException
Results
object, and places the
duplicate immediately before, or after, the referenced element. The children, if any, of those elements are also
duplicated.
InsertDuplicateBefore
- true
if the duplicate should be inserted before the item that was
duplicated, false
if it should be inserted after.
Results
object that references each duplicate.
TagException
- If a problem is encountered with the manipulation of the markup.public Results replace(Object Replacement) throws TagException
Results
object with the supplied material.
Replacement
- Any type of object is potentially suitable, see MutableMarkup.insert
for details.
Results
object that references each replacement.
TagException
- If a problem is encountered with the manipulation of the markup.public Results addBefore(Object NewStuff) throws TagException
Results
object.
NewStuff
- Any type of object is potentially suitable, see MutableMarkup.insert
for details.
Results
object that references the inserted material.
TagException
- If a problem is encountered with the manipulation of the markup.public Results addAfter(Object NewStuff) throws TagException
Results
object.
NewStuff
- Any type of object is potentially suitable, see MutableMarkup.insert
for details.
Results
object that references the inserted material.
TagException
- If a problem is encountered with the manipulation of the markup.@Deprecated public Results insertBefore(Object NewStuff) throws TagException
addBefore
instead.
Results
object.
NewStuff
- Any type of object is potentially suitable, see MutableMarkup.insert
for details.
Results
object that references the inserted material.
TagException
- If a problem is encountered with the manipulation of the markup.@Deprecated public Results insertAfter(Object NewStuff) throws TagException
addAfter
instead.
Results
object.
NewStuff
- Any type of object is potentially suitable, see MutableMarkup.insert
for details.
Results
object that references the inserted material.
TagException
- If a problem is encountered with the manipulation of the markup.@Deprecated public Results insert(boolean InsertBefore, Object NewStuff) throws TagException
add
instead.
Results
object.
InsertBefore
- true
if the new material should be inserted before the matches,
false
if it should be inserted after.NewStuff
- Any type of object is potentially suitable, see MutableMarkup.insert
for details.
Results
object that references the inserted material.
TagException
- If a problem is encountered with the manipulation of the markup.public Results add(boolean AddBefore, Object NewStuff) throws TagException
Results
object.
AddBefore
- true
if the new material should be inserted before the matches,
false
if it should be inserted after.NewStuff
- Any type of object is potentially suitable, see MutableMarkup.insert
for details.
Results
object that references the inserted material.
TagException
- If a problem is encountered with the manipulation of the markup.public Results delete() throws TagException
Results
object.
Results
object.
TagException
- If a problem is encountered with the manipulation of the markup.public String toString()
String
representation of all of the XML elements (and any associated children) referenced by
the matches in this Results
object.
toString
in class Object
String
representation of all of the XML elements referenced by this Results
object.public MutableMarkup toMarkup()
MutableMarkup
object containing all of the XML elements (and any associated children)
referenced by the matches in this Results
object. Note that the elements in this markup are the same
elements that are present in the original markup, and changes to these elements in either body of markup will
result in changes to these elements both bodies of markup.
MutableMarkup
object containing all of the XML elements referenced by this
Results
object.copy()
public Results extract() throws TagException
Results
object
into a new MutableMarkup
object, then returns a new Results
object containing references
to those elements in their new home. This is useful for extracting a section of a document—typically a
template—to get it out of the way until it is needed at a later time for use in the same document, or in a
completely different one. Attempts to change the extracted markup by using lingering references to it in
Match
or Results
objects will fail. However, if references have been retained to
individal, mutable Range
objects in the markup that was extracted, modifications to the extracted
markup can be performed using them. That's not a normal usage mode, and you would probably know if you were keeping
and using such references, so it's usually not worth worrying about, but if you need to be certain that nothing can
modify the extracted markup through such lingering references, use the cut()
method instead.
Results
object that references all of the extracted material
in the new MutableMarkup
object that was automatically created to
contain it.
TagException
- If a problem is encountered with the manipulation of the markup.extractToMarkup()
,
cut()
public MutableMarkup extractToMarkup() throws TagException
Results
object
into a new MutableMarkup
object. This is useful for extracting a section of a document—typically
a template—to get it out of the way until it's needed at a later time for use in the same document, or in a
completely different one. Attempts to change the extracted markup by using lingering references to it in
Match
or Results
objects will fail. However, if references have been retained to
individal, mutable Range
objects in the markup that was extracted, modifications to the extracted
markup can be performed using them. That's not a normal usage mode, and you would probably know if you were keeping
and using such references, so it's usually not worth worrying about, but if you need to be certain that nothing can
modify the extracted markup through such lingering references, use the cut()
method instead.
MutableMarkup
object containing all of the extracted material.
TagException
- If a problem is encountered with the manipulation of the markup.extract()
,
cut()
public ImmutableMarkup copy() throws TagException
Results
object. Changes to the original markup will not affect this copy.
ImmutableMarkup
object that is a copy of all of the markup
represented by the matches in this Results
object.
TagException
- If a problem is encountered with the manipulation of the markup.toMarkup()
public ImmutableMarkup cut() throws TagException
Results
object, and returns it in a new ImmutableMarkup
object. Changes to the original markup will not affect
this copy.
MutableMarkup
object that holds all of the markup represented
by the matches in this Results
object.
TagException
- If a problem is encountered with the manipulation of the markup.extractToMarkup()
,
extract()
public Results addClass(String ClassList) throws TagException
Results
object. The "class" attribute will be created,
as necessary. Duplicate class names are detected and omitted, so there's no need to worry about redundancy.
ClassList
- Space-separated list of class names.
Results
object containing all of the matches in this
Results
object.
TagException
- If a problem is encountered with the manipulation of the markup.setClass(String)
public Results setClass(String ClassList) throws TagException
Results
object. The "class" attribute will be created, as necessary.
ClassList
- Space-separated list of class names.
Results
object.
TagException
- If a problem is encountered with the manipulation of the markup.addClass(String)
public Results deleteClass(String ClassList) throws TagException
Results
object. If the "class" attribute becomes empty,
it will be omitted from the resulting markup.
ClassList
- Space-separated list of class names.
Results
object containing all of the matches in this
Results
object.
TagException
- If a problem is encountered with the manipulation of the markup.public String getAttribute(String AttrName)
Results
object. If there are
multiple matches in this Results
object and you want the attribute value from each one, you will have
to retrieve each match individually (using get(int)
or iterator()
) and invoke
Match.getAttribute
on each one.
AttrName
- Name of the attribute.
null
if there is no such attribute.public Results addAttribute(String AttrName, Object AttrValue) throws TagException
Results
object. If the attribute is already present, the new value is appended to the existing value. Where that appending
behavior is not wanted, use setAttribute
.
AttrName
- Name of the attribute. (For the "class" attribute, addClass
is more efficient.)AttrValue
- Value of the attribute. Can be null
. If not null
, the
object's toString
method is invoked.
Results
object containing all of the matches in this
Results
object.
TagException
- If a problem is encountered with the manipulation of the markup.setAttribute(String, Object)
public Results updateAttribute(String AttrName, Object AttrValue) throws TagException
Results
object. If the attribute does not exist, nothing happens. If it does exist, its value is
replaced by the new value.
AttrName
- Name of the attribute. (For the "class" attribute, setClass
is more efficient.)AttrValue
- Value of the attribute. Can be null
. If not null
, the
object's toString
method is invoked.
Results
object containing all of the matches in this
Results
object.
TagException
- If a problem is encountered with the manipulation of the markup.public Results setAttribute(String AttrName, Object AttrValue) throws TagException
Results
object. If the attribute does not exist, it is created. If it does exist, its value is
replaced by the new value.
AttrName
- Name of the attribute. (For the "class" attribute, setClass
is more efficient.)AttrValue
- Value of the attribute. Can be null
. If not null
, the
object's toString
method is invoked.
Results
object containing all of the matches in this
Results
object.
TagException
- If a problem is encountered with the manipulation of the markup.public Results setAttributes(Object... AttrNamesAndValues) throws TagException
Results
object. If the attribute does not exist, it is created. If it does exist,
its value is replaced by the new value.
AttrNamesAndValues
- Array of name/value pairs specify the attributes to be set. The first element in
each pair is the name, and the second is the value. The value can be
null
.
Results
object containing all of the matches in this
Results
object.
TagException
- If a problem is encountered with the manipulation of the markup.public Results deleteAttribute(String AttrName) throws TagException
Results
object.
AttrName
- Name of the attribute to be deleted.
Results
object containing all of the matches in this
Results
object.
TagException
- If a problem is encountered with the manipulation of the markup.@Deprecated public Results print()
toString()
instead.
Results
object to System.out
.
Results
object, unaltered.toString()
@Deprecated public Results print(String Prefix)
toString()
instead.
Results
object to System.out
with
each line prefixed by the supplied string.
Prefix
- A String
to be used a prefix for each line of output. (Handy for
indenting.)
Results
object, unaltered.toString()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |