org.joox
Interface X

All Superinterfaces:
Iterable<Element>

public interface X
extends Iterable<Element>

A wrapper type for Element

This is the main type of the jOOX library. It wraps an ordered list of DOM elements without duplicates and provides useful operations upon all of the contained elements. The API has been inspired by http://jquery.com, a fantastic DOM abstraction library for JavaScript.

Author:
Lukas Eder
See Also:
http://jquery.com

Method Summary
 X add(Element... elements)
          Add some elements to the set of matched elements
 X add(X... elements)
          Add some elements to the set of matched elements
 X after(Content content)
          Add content after each element in the set of matched elements.
 X after(String content)
          Add content after each element in the set of matched elements.
 X append(Content content)
          Append content to the end of each element's content in the set of matched elements.
 X append(String content)
          Append content to the end of each element's content in the set of matched elements.
 String attr(String name)
          Get the attribute name from the first element in the set of matched elements, or null if the first element does not have that attribute.
 X attr(String name, Content value)
          Set an attribute on all elements in the set of matched elements.
 X attr(String name, String value)
          Set an attribute on all elements in the set of matched elements.
 List<String> attrs(String name)
          Get the attribute name from all elements in the set of matched elements
 X before(Content content)
          Add content before each element in the set of matched elements.
 X before(String content)
          Add content before each element in the set of matched elements.
 X children()
          Find all children of each element in the current set of matched elements.
 X children(Filter filter)
          Find all children of each element in the current set of matched elements.
 X children(String selector)
          Find all children of each element in the current set of matched elements.
 String content()
          Get the XML content of the first element in the set of matched elements, or null if there are no matched elements
 X content(Content content)
          Add some XML content to all elements in the set of matched elements (possibly replacing existing content).
 X content(String content)
          Add some XML content to all elements in the set of matched elements (possibly replacing existing content).
 List<String> contents()
          Get all XML content of the elements in the set of matched elements.
 X copy()
          Get a copy of the X wrapper.
 X each(Each each)
          Execute a callback for every element in the current set of matched elements.
 X empty()
          Removes all content from all elements in the set of matched elements.
 X eq(int index)
          Reduce the current set of matched elements to the element at a given index
 X filter(Filter filter)
          Reduce the current set of matched elements.
 X filter(String selector)
          Reduce the current set of matched elements.
 X find()
          Find all descendants of each element in the current set of matched elements.
 X find(Filter filter)
          Find all descendants of each element in the current set of matched elements.
 X find(String selector)
          Find all descendants of each element in the current set of matched elements.
 X first()
          Get the first in a set of matched elements.
 List<Element> get()
          Get an the set of matched elements
 Element get(int index)
          Get an element from the set of matched elements at a given index
 X has(Filter filter)
          Reduce the set of matched element to those who have a descendant that matches a filter.
 X has(String selector)
          Reduce the set of matched element to those who have a descendant that matches a selector.
 String id()
          Get the first id value This is the same as calling id(0)
 String id(int index)
          Get a list of id values in the current set of matched elements.
 List<String> ids()
          Get a list of id values in the current set of matched elements.
 boolean is(Filter filter)
          Check if at least one element in the set of matched elements satisfies a filter.
 boolean is(String selector)
          Check if at least one element in the set of matched elements satisfies a selector.
 X last()
          Get the last in a set of matched elements.
<E> List<E>
map(Mapper<E> map)
          Map the set of matched elements to a list of something
 X next()
          Get the immediate next sibling of every element in set of matched elements.
 X next(Filter filter)
          Get the immediate next sibling of every element in set of matched elements, matching a filter
 X next(String selector)
          Get the immediate next sibling of every element in set of matched elements, matching a selector
 X nextAll()
          Get all next siblings of every element in a set of matched elements
 X nextAll(Filter filter)
          Get all next siblings of every element in a set of matched elements, matching a filter
 X nextAll(String selector)
          Get all next siblings of every element in a set of matched elements, matching a selector
 X nextUntil(Filter until)
          Get all next siblings of every element in a set of matched elements until the provided filter matches
 X nextUntil(Filter until, Filter filter)
          Get all next siblings of every element in a set of matched elements, matching a filter until the provided filter matches
 X nextUntil(Filter until, String selector)
          Get all next siblings of every element in a set of matched elements, matching a selector until the provided filter matches
 X nextUntil(String until)
          Get all next siblings of every element in a set of matched elements until the provided selector matches
 X nextUntil(String until, Filter filter)
          Get all next siblings of every element in a set of matched elements, matching a filter, until the provided selector matches
 X nextUntil(String until, String selector)
          Get all next siblings of every element in a set of matched elements, matching a selector, until the provided selector matches
 X not(Filter filter)
          Remove elements from the set of matched elements.
 X not(String selector)
          Remove elements from the set of matched elements.
 X parent()
          Get the immediate parent elements of every element in a set of matched elements
 X parent(Filter filter)
          Get the immediate parent elements of every element in a set of matched elements, matching a filter
 X parent(String selector)
          Get the immediate parent elements of every element in a set of matched elements, matching a selector
 X parents()
          Get all ancestor elements of every element in a set of matched elements
 X parents(Filter filter)
          Get all ancestor elements of every element in a set of matched elements, matching a filter
 X parents(String selector)
          Get all ancestor elements of every element in a set of matched elements, matching a selector
 X parentsUntil(Filter until)
          Get all ancestors of every element in a set of matched elements until the provided filter matches
 X parentsUntil(Filter until, Filter filter)
          Get all ancestors of every element in a set of matched elements, matching a filter until the provided filter matches
 X parentsUntil(Filter until, String selector)
          Get all ancestors of every element in a set of matched elements, matching a selector until the provided filter matches
 X parentsUntil(String until)
          Get all ancestors of every element in a set of matched elements until the provided selector matches
 X parentsUntil(String until, Filter filter)
          Get all ancestors of every element in a set of matched elements, matching a filter, until the provided selector matches
 X parentsUntil(String until, String selector)
          Get all ancestors of every element in a set of matched elements, matching a selector, until the provided selector matches
 X prepend(Content content)
          Prepend content to the beginning of each element's content in the set of matched elements.
 X prepend(String content)
          Prepend content to the beginning of each element's content in the set of matched elements.
 X prev()
          Get the immediate previous sibling of every element in set of matched elements.
 X prev(Filter filter)
          Get the immediate previous sibling of every element in set of matched elements, matching a filter
 X prev(String selector)
          Get the immediate previous sibling of every element in set of matched elements, matching a selector
 X prevAll()
          Get all previous siblings of every element in a set of matched elements
 X prevAll(Filter filter)
          Get all previous siblings of every element in a set of matched elements, matching a filter
 X prevAll(String selector)
          Get all previous siblings of every element in a set of matched elements, matching a selector
 X prevUntil(Filter until)
          Get all previous siblings of every element in a set of matched elements until the provided filter matches
 X prevUntil(Filter until, Filter filter)
          Get all previous siblings of every element in a set of matched elements, matching a filter until the provided filter matches
 X prevUntil(Filter until, String selector)
          Get all previous siblings of every element in a set of matched elements, matching a selector until the provided filter matches
 X prevUntil(String until)
          Get all previous siblings of every element in a set of matched elements until the provided selector matches
 X prevUntil(String until, Filter filter)
          Get all previous siblings of every element in a set of matched elements, matching a filter, until the provided selector matches
 X prevUntil(String until, String selector)
          Get all previous siblings of every element in a set of matched elements, matching a selector, until the provided selector matches
 X remove()
          Removes all elements in the set of matched elements.
 X remove(Filter filter)
          Removes all elements in the set of matched elements, matching a filter
 X remove(String selector)
          Removes all elements in the set of matched elements, matching a selector
 X removeAttr(String name)
          Remove an attribute from all elements in the set of matched elements.
 X replaceWith(Content content)
          Replace all elements in the set of matched elements with some new content.
 X replaceWith(String content)
          Replace all elements in the set of matched elements with some new content.
 X siblings()
          Get all siblings of every element in a set of matched elements
 X siblings(Filter filter)
          Get all siblings of every element in a set of matched elements, matching a filter
 X siblings(String selector)
          Get all siblings of every element in a set of matched elements, matching a selector
 int size()
          Get the number of matched elements in the set of matched elements
 X slice(int start)
          Reduce the set of matched elements by specifying a range of indexes This is the same as calling slice(start, Integer.MAX_VALUE)
 X slice(int start, int end)
          Reduce the set of matched elements by specifying a range of indexes
 String tag()
          Get the first tag name in the current set of matched elements.
 String tag(int index)
          Get a list of tag names in the current set of matched elements.
 List<String> tags()
          Get a list of tag names in the current set of matched elements.
 String text()
          Get the text content of the first element in the set of matched elements, or null if there are no matched elements.
 X text(Content content)
          Set some text content to all elements in the set of matched elements (possibly replacing existing content).
 X text(String content)
          Set some text content to all elements in the set of matched elements (possibly replacing existing content).
 List<String> texts()
          Get all text content of the elements in the set of matched elements.
 
Methods inherited from interface java.lang.Iterable
iterator
 

Method Detail

get

Element get(int index)
Get an element from the set of matched elements at a given index


get

List<Element> get()
Get an the set of matched elements


size

int size()
Get the number of matched elements in the set of matched elements


add

X add(Element... elements)
Add some elements to the set of matched elements


add

X add(X... elements)
Add some elements to the set of matched elements


children

X children()
Find all children of each element in the current set of matched elements.


children

X children(String selector)
Find all children of each element in the current set of matched elements.


children

X children(Filter filter)
Find all children of each element in the current set of matched elements.


each

X each(Each each)
Execute a callback for every element in the current set of matched elements.


filter

X filter(String selector)
Reduce the current set of matched elements.


filter

X filter(Filter filter)
Reduce the current set of matched elements.


eq

X eq(int index)
Reduce the current set of matched elements to the element at a given index


find

X find()
Find all descendants of each element in the current set of matched elements.


find

X find(String selector)
Find all descendants of each element in the current set of matched elements.


find

X find(Filter filter)
Find all descendants of each element in the current set of matched elements.


first

X first()
Get the first in a set of matched elements.


has

X has(String selector)
Reduce the set of matched element to those who have a descendant that matches a selector.


has

X has(Filter filter)
Reduce the set of matched element to those who have a descendant that matches a filter.


is

boolean is(String selector)
Check if at least one element in the set of matched elements satisfies a selector.


is

boolean is(Filter filter)
Check if at least one element in the set of matched elements satisfies a filter.


last

X last()
Get the last in a set of matched elements.


map

<E> List<E> map(Mapper<E> map)
Map the set of matched elements to a list of something


next

X next()
Get the immediate next sibling of every element in set of matched elements.


next

X next(String selector)
Get the immediate next sibling of every element in set of matched elements, matching a selector


next

X next(Filter filter)
Get the immediate next sibling of every element in set of matched elements, matching a filter


nextAll

X nextAll()
Get all next siblings of every element in a set of matched elements


nextAll

X nextAll(String selector)
Get all next siblings of every element in a set of matched elements, matching a selector


nextAll

X nextAll(Filter filter)
Get all next siblings of every element in a set of matched elements, matching a filter


nextUntil

X nextUntil(String until)
Get all next siblings of every element in a set of matched elements until the provided selector matches


nextUntil

X nextUntil(Filter until)
Get all next siblings of every element in a set of matched elements until the provided filter matches


nextUntil

X nextUntil(String until,
            String selector)
Get all next siblings of every element in a set of matched elements, matching a selector, until the provided selector matches


nextUntil

X nextUntil(String until,
            Filter filter)
Get all next siblings of every element in a set of matched elements, matching a filter, until the provided selector matches


nextUntil

X nextUntil(Filter until,
            String selector)
Get all next siblings of every element in a set of matched elements, matching a selector until the provided filter matches


nextUntil

X nextUntil(Filter until,
            Filter filter)
Get all next siblings of every element in a set of matched elements, matching a filter until the provided filter matches


not

X not(String selector)
Remove elements from the set of matched elements.


not

X not(Filter filter)
Remove elements from the set of matched elements.


parent

X parent()
Get the immediate parent elements of every element in a set of matched elements


parent

X parent(String selector)
Get the immediate parent elements of every element in a set of matched elements, matching a selector


parent

X parent(Filter filter)
Get the immediate parent elements of every element in a set of matched elements, matching a filter


parents

X parents()
Get all ancestor elements of every element in a set of matched elements


parents

X parents(String selector)
Get all ancestor elements of every element in a set of matched elements, matching a selector


parents

X parents(Filter filter)
Get all ancestor elements of every element in a set of matched elements, matching a filter


parentsUntil

X parentsUntil(String until)
Get all ancestors of every element in a set of matched elements until the provided selector matches


parentsUntil

X parentsUntil(Filter until)
Get all ancestors of every element in a set of matched elements until the provided filter matches


parentsUntil

X parentsUntil(String until,
               String selector)
Get all ancestors of every element in a set of matched elements, matching a selector, until the provided selector matches


parentsUntil

X parentsUntil(String until,
               Filter filter)
Get all ancestors of every element in a set of matched elements, matching a filter, until the provided selector matches


parentsUntil

X parentsUntil(Filter until,
               String selector)
Get all ancestors of every element in a set of matched elements, matching a selector until the provided filter matches


parentsUntil

X parentsUntil(Filter until,
               Filter filter)
Get all ancestors of every element in a set of matched elements, matching a filter until the provided filter matches


prev

X prev()
Get the immediate previous sibling of every element in set of matched elements.


prev

X prev(String selector)
Get the immediate previous sibling of every element in set of matched elements, matching a selector


prev

X prev(Filter filter)
Get the immediate previous sibling of every element in set of matched elements, matching a filter


prevAll

X prevAll()
Get all previous siblings of every element in a set of matched elements


prevAll

X prevAll(String selector)
Get all previous siblings of every element in a set of matched elements, matching a selector


prevAll

X prevAll(Filter filter)
Get all previous siblings of every element in a set of matched elements, matching a filter


prevUntil

X prevUntil(String until)
Get all previous siblings of every element in a set of matched elements until the provided selector matches


prevUntil

X prevUntil(Filter until)
Get all previous siblings of every element in a set of matched elements until the provided filter matches


prevUntil

X prevUntil(String until,
            String selector)
Get all previous siblings of every element in a set of matched elements, matching a selector, until the provided selector matches


prevUntil

X prevUntil(String until,
            Filter filter)
Get all previous siblings of every element in a set of matched elements, matching a filter, until the provided selector matches


prevUntil

X prevUntil(Filter until,
            String selector)
Get all previous siblings of every element in a set of matched elements, matching a selector until the provided filter matches


prevUntil

X prevUntil(Filter until,
            Filter filter)
Get all previous siblings of every element in a set of matched elements, matching a filter until the provided filter matches


siblings

X siblings()
Get all siblings of every element in a set of matched elements


siblings

X siblings(String selector)
Get all siblings of every element in a set of matched elements, matching a selector


siblings

X siblings(Filter filter)
Get all siblings of every element in a set of matched elements, matching a filter


slice

X slice(int start)
Reduce the set of matched elements by specifying a range of indexes

This is the same as calling slice(start, Integer.MAX_VALUE)


slice

X slice(int start,
        int end)
Reduce the set of matched elements by specifying a range of indexes


before

X before(String content)
Add content before each element in the set of matched elements.


before

X before(Content content)
Add content before each element in the set of matched elements.


after

X after(String content)
Add content after each element in the set of matched elements.


after

X after(Content content)
Add content after each element in the set of matched elements.


prepend

X prepend(String content)
Prepend content to the beginning of each element's content in the set of matched elements.


prepend

X prepend(Content content)
Prepend content to the beginning of each element's content in the set of matched elements.


append

X append(String content)
Append content to the end of each element's content in the set of matched elements.


append

X append(Content content)
Append content to the end of each element's content in the set of matched elements.


replaceWith

X replaceWith(String content)
Replace all elements in the set of matched elements with some new content.


replaceWith

X replaceWith(Content content)
Replace all elements in the set of matched elements with some new content.


empty

X empty()
Removes all content from all elements in the set of matched elements.


remove

X remove()
Removes all elements in the set of matched elements.


remove

X remove(String selector)
Removes all elements in the set of matched elements, matching a selector


remove

X remove(Filter filter)
Removes all elements in the set of matched elements, matching a filter


attr

String attr(String name)
Get the attribute name from the first element in the set of matched elements, or null if the first element does not have that attribute.


attrs

List<String> attrs(String name)
Get the attribute name from all elements in the set of matched elements


attr

X attr(String name,
       String value)
Set an attribute on all elements in the set of matched elements. If value is null, then the attribute is removed. If the attribute already exists, then it is replaced.


attr

X attr(String name,
       Content value)
Set an attribute on all elements in the set of matched elements. If value returns null, then the attribute is removed. If the attribute already exists, then it is replaced.


removeAttr

X removeAttr(String name)
Remove an attribute from all elements in the set of matched elements. This is the same as calling attr(name, null).


content

String content()
Get the XML content of the first element in the set of matched elements, or null if there are no matched elements


contents

List<String> contents()
Get all XML content of the elements in the set of matched elements.


content

X content(String content)
Add some XML content to all elements in the set of matched elements (possibly replacing existing content). If the supplied content is invalid XML or plain text, then it will be added as text just as with text(String)


content

X content(Content content)
Add some XML content to all elements in the set of matched elements (possibly replacing existing content). If the supplied content is invalid XML or plain text, then it will be added as text just as with text(String)


text

String text()
Get the text content of the first element in the set of matched elements, or null if there are no matched elements.


texts

List<String> texts()
Get all text content of the elements in the set of matched elements.


text

X text(String content)
Set some text content to all elements in the set of matched elements (possibly replacing existing content).


text

X text(Content content)
Set some text content to all elements in the set of matched elements (possibly replacing existing content).


copy

X copy()
Get a copy of the X wrapper. This is not a deep-copy of wrapped Element objects. Both this and the copy will reference the same Element's


tag

String tag()
Get the first tag name in the current set of matched elements.

This is the same as calling tag(0)


tag

String tag(int index)
Get a list of tag names in the current set of matched elements.


tags

List<String> tags()
Get a list of tag names in the current set of matched elements.


id

String id()
Get the first id value

This is the same as calling id(0)


id

String id(int index)
Get a list of id values in the current set of matched elements.

This is the same as calling eq(index).attr("id")


ids

List<String> ids()
Get a list of id values in the current set of matched elements.

This is the same as calling attrs("id")



Copyright © 2011. All Rights Reserved.