Package org.joox

Interface Match

All Superinterfaces:
Iterable<Element>

public interface Match 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 wrapped DOM elements have been previously "matched" by a jOOX operation.

The API has been inspired by http://jquery.com, a fantastic DOM abstraction library for JavaScript.

Author:
Lukas Eder
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    add(Match... elements)
    Add some elements to the set of matched elements
    add(Element... elements)
    Add some elements to the set of matched elements
    after(String content)
    Add content after each element in the set of matched elements.
    after(Content content)
    Add content after each element in the set of matched elements.
    after(Match... content)
    Add content after each element in the set of matched elements.
    after(Element... content)
    Add content after each element in the set of matched elements.
    Add the previous set of matched elements to the current one.
    append(String content)
    Append content to the end of each element's content in the set of matched elements.
    append(Content content)
    Append content to the end of each element's content in the set of matched elements.
    append(Match... content)
    Append content to the end of each element's content in the set of matched elements.
    append(Element... content)
    Append content to the end of each element's content in the set of matched elements.
    attr(String name)
    Get an attribute from the first element in the set of matched elements, or null if the first element does not have that attribute.
    <T> T
    attr(String name, Class<T> type)
    Get a converted attribute from the first element in the set of matched elements, or null if the first element does not have that attribute.
    attr(String name, String value)
    Set an attribute on all elements in the set of matched elements.
    attr(String name, Content value)
    Set an attribute on all elements in the set of matched elements.
    Get the set of available attribute names in the set of matched elements.
    attrs(String name)
    Get an attribute from all elements in the set of matched elements
    <T> List<T>
    attrs(String name, Class<T> type)
    Get a converted attribute from all elements in the set of matched elements
    before(String content)
    Add content before each element in the set of matched elements.
    before(Content content)
    Add content before each element in the set of matched elements.
    before(Match... content)
    Add content before each element in the set of matched elements.
    before(Element... content)
    Add content before each element in the set of matched elements.
    Get the CDATA content of the first element in the set of matched elements, or null if there are no matched elements.
    cdata(int index)
    Get the CDATA content at a given index in the current set of matched elements.
    <T> T
    cdata(Class<T> type)
    Get the converted CDATA content of the first element in the set of matched elements, or null if there are no matched elements.
    cdata(String content)
    Set some CDATA content to all elements in the set of matched elements (possibly replacing existing content).
    cdata(Content content)
    Set some CDATA content to all elements in the set of matched elements (possibly replacing existing content).
    Get all CDATA content of the elements in the set of matched elements.
    cdatas(int... indexes)
    Get all CDATA content of the elements at given indexes in the set of matched elements.
    <T> List<T>
    cdatas(Class<T> type)
    Get all converted CDATA content of the elements in the set of matched elements.
    Find the first child of each element in the current set of matched elements.
    child(int index)
    Find the child at a given index of each element in the current set of matched elements.
    child(String selector)
    Find the first matching child of each element in the current set of matched elements
    child(Filter filter)
    Find the first matching child of each element in the current set of matched elements
    Find all children of each element in the current set of matched elements.
    children(int... indexes)
    Find all children of each element at given indexes in the current set of matched elements.
    children(String selector)
    Find all children of each element in the current set of matched elements.
    children(Filter filter)
    Find all children of each element in the current set of matched elements.
    Get the XML content of the first element in the set of matched elements, or null if there are no matched elements.
    content(int index)
    Get the XML content at a given index in the current set of matched elements.
    content(Object content)
    Add some JAXB-marshallable XML content to all elements in the set of matched elements (possibly replacing existing content).
    content(String content)
    Add some XML content to all elements in the set of matched elements (possibly replacing existing content).
    content(Content content)
    Add some XML content to all elements in the set of matched elements (possibly replacing existing content).
    Get all XML content of the elements in the set of matched elements.
    contents(int... indexes)
    Get all XML content of the elements at given indexes in the set of matched elements.
    Get a copy of the Match wrapper.
    Get the underlying document of the set of matched elements.
    Get all elements in the set of matched elements in a list of matches, every match representing one element
    each(Iterable<? extends Each> each)
    Execute several callbacks for every element in the current set of matched elements.
    each(Each each)
    Execute a callback for every element in the current set of matched elements.
    each(Each... each)
    Execute several callbacks for every element in the current set of matched elements.
    Removes all content from all elements in the set of matched elements.
    eq(int... indexes)
    Reduce the current set of matched elements to the elements at the given indexes.
    filter(String selector)
    Reduce the current set of matched elements.
    filter(Filter filter)
    Reduce the current set of matched elements.
    Find all descendants of each element in the current set of matched elements.
    find(String selector)
    Find all descendants of each element in the current set of matched elements.
    find(Filter filter)
    Find all descendants of each element in the current set of matched elements.
    Get the first in a set of matched elements.
    get()
    Get an the set of matched elements
    get(int index)
    Get an element from the set of matched elements at a given index
    get(int... indexes)
    Get some elements from the set of matched elements at the given indexes
    has(String selector)
    Reduce the set of matched element to those who have a descendant that matches a selector.
    has(Filter filter)
    Reduce the set of matched element to those who have a descendant that matches a filter.
    id()
    Get the first id value
    id(int index)
    Get an id value at a given index in the current set of matched elements.
    <T> T
    id(Class<T> type)
    Get the first converted id value
    ids()
    Get a list of id values in the current set of matched elements.
    ids(int... indexes)
    Get a list of id values at given indexes in the current set of matched elements.
    <T> List<T>
    ids(Class<T> type)
    Get a list of converted id values in the current set of matched elements.
    boolean
    is(String selector)
    Check if at least one element in the set of matched elements satisfies a selector.
    boolean
    is(Filter filter)
    Check if at least one element in the set of matched elements satisfies a filter.
    boolean
    Whether there are any matched elements in the set of matched elements
    boolean
    Whether there are any matched elements in the set of matched elements
    Get the last in a set of matched elements.
    Reduce the set of matched elements to the ones that are leaf elements
    <E> List<E>
    map(Mapper<E> map)
    Map the set of matched elements to a list of something
    matchAttr(String name, String valueRegex)
    Reduce the set of matched elements by filtering out those whose attribute content doesn't match a given regex
    matchAttr(String name, String valueRegex, boolean keepMatches)
    Reduce the set of matched elements by filtering out those whose attribute content doesn't match a given regex (keepMatches = true), or those whose text content matches a given regex (keepMatches = false)
    Reduce the set of matched elements by filtering out those whose tag name doesn't match a given regex
    matchTag(String regex, boolean keepMatches)
    Reduce the set of matched elements by filtering out those whose tag name doesn't match a given regex (keepMatches = true), or those whose tag name matches a given regex (keepMatches = false)
    Reduce the set of matched elements by filtering out those whose text content doesn't match a given regex
    matchText(String regex, boolean keepMatches)
    Reduce the set of matched elements by filtering out those whose text content doesn't match a given regex (keepMatches = true), or those whose text content matches a given regex (keepMatches = false)
    namespace(String namespacePrefix, String namespaceURI)
    Get a new Match with added namespace configuration for subsequent XPath calls
    Get the namespace prefix of the first element in the current set of matched elements.
    namespacePrefix(int index)
    Get a namespace prefix of the element at a given index in the current set of matched elements.
    Get a list of namespace prefixes of the elements in the current set of matched elements.
    namespacePrefixes(int... indexes)
    Get a list of namespace prefixes of the elements at given indexes in the current set of matched elements.
    Get a new Match with added namespace configuration for subsequent XPath calls
    Get the namespace URI of the first element in the current set of matched elements.
    namespaceURI(int index)
    Get a namespace URI of the element at a given index in the current set of matched elements.
    Get a list of namespace URIs of the elements in the current set of matched elements.
    namespaceURIs(int... indexes)
    Get a list of namespace URIs of the elements at given indexes in the current set of matched elements.
    Get the immediate next sibling of every element in set of matched elements.
    next(String selector)
    Get the immediate next sibling of every element in set of matched elements, matching a selector
    next(Filter filter)
    Get the immediate next sibling of every element in set of matched elements, matching a filter
    Get all next siblings of every element in a set of matched elements
    nextAll(String selector)
    Get all next siblings of every element in a set of matched elements, matching a selector
    nextAll(Filter filter)
    Get all next siblings of every element in a set of matched elements, matching a filter
    Get all next siblings of every element in a set of matched elements until the provided selector matches
    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(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
    Get all next siblings of every element in a set of matched elements until the provided filter matches
    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(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(String selector)
    Remove elements from the set of matched elements.
    not(Filter filter)
    Remove elements from the set of matched elements.
    Get the immediate parent elements of every element in a set of matched elements
    parent(String selector)
    Get the immediate parent elements of every element in a set of matched elements, matching a selector
    parent(Filter filter)
    Get the immediate parent elements of every element in a set of matched elements, matching a filter
    Get all ancestor elements of every element in a set of matched elements
    parents(String selector)
    Get all ancestor elements of every element in a set of matched elements, matching a selector
    parents(Filter filter)
    Get all ancestor elements of every element in a set of matched elements, matching a filter
    Get all ancestors of every element in a set of matched elements until the provided selector matches
    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(String until, Filter filter)
    Get all ancestors of every element in a set of matched elements, matching a filter, until the provided selector matches
    Get all ancestors of every element in a set of matched elements until the provided filter matches
    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(Filter until, Filter filter)
    Get all ancestors of every element in a set of matched elements, matching a filter until the provided filter matches
    prepend(String content)
    Prepend content to the beginning of each element's content in the set of matched elements.
    prepend(Content content)
    Prepend content to the beginning of each element's content in the set of matched elements.
    prepend(Match... content)
    Prepend content to the beginning of each element's content in the set of matched elements.
    prepend(Element... content)
    Prepend content to the beginning of each element's content in the set of matched elements.
    Get the immediate previous sibling of every element in set of matched elements.
    prev(String selector)
    Get the immediate previous sibling of every element in set of matched elements, matching a selector
    prev(Filter filter)
    Get the immediate previous sibling of every element in set of matched elements, matching a filter
    Get all previous siblings of every element in a set of matched elements
    prevAll(String selector)
    Get all previous siblings of every element in a set of matched elements, matching a selector
    prevAll(Filter filter)
    Get all previous siblings of every element in a set of matched elements, matching a filter
    Get all previous siblings of every element in a set of matched elements until the provided selector matches
    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(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
    Get all previous siblings of every element in a set of matched elements until the provided filter matches
    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(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
    Removes all elements from their parent nodes in the set of matched elements.
    remove(String selector)
    Removes all elements from their parent nodes in the set of matched elements, matching a selector
    remove(Filter filter)
    Removes all elements from their parent nodes in the set of matched elements, matching a filter
    Remove an attribute from all elements in the set of matched elements.
    Rename all tags in the set of matched elements to some new tag name
    Rename all tags in the set of matched elements to some new tag name
    Replace all elements in the set of matched elements with some new content.
    Replace all elements in the set of matched elements with some new content.
    replaceWith(Match... content)
    Replace all elements in the set of matched elements with some new content.
    replaceWith(Element... content)
    Replace all elements in the set of matched elements with some new content.
    Reverse the order of the set of matched elements
    Get all siblings of every element in a set of matched elements
    siblings(String selector)
    Get all siblings of every element in a set of matched elements, matching a selector
    siblings(Filter filter)
    Get all siblings of every element in a set of matched elements, matching a filter
    int
    Get the number of matched elements in the set of matched elements
    slice(int start)
    Reduce the set of matched elements by specifying a range of indexes
    slice(int start, int end)
    Reduce the set of matched elements by specifying a range of indexes
    sort(Comparator<Element> comparator)
    Allows to sort the result with the given comparator.
    tag()
    Get the tag name of the first element in the current set of matched elements.
    tag(int index)
    Get a tag name of the element at a given index in the current set of matched elements.
    Get a list of tag names of the elements in the current set of matched elements.
    tags(int... indexes)
    Get a list of tag names of the elements at given indexes in the current set of matched elements.
    Get the text content of the first element in the set of matched elements, or null if there are no matched elements.
    text(int index)
    Get the text content at a given index in the current set of matched elements.
    <T> T
    text(Class<T> type)
    Get the converted text content of the first element in the set of matched elements, or null if there are no matched elements.
    text(String content)
    Set some text content to all elements in the set of matched elements (possibly replacing existing content).
    text(Content content)
    Set some text content to all elements in the set of matched elements (possibly replacing existing content).
    Get all text content of the elements in the set of matched elements.
    texts(int... indexes)
    Get all text content of the elements at given indexes in the set of matched elements.
    <T> List<T>
    texts(Class<T> type)
    Get all converted text content of the elements in the set of matched elements.
    transform(File transformer)
    Transform all elements in the set of matched elements.
    transform(InputStream transformer)
    Transform all elements in the set of matched elements.
    transform(Reader transformer)
    Transform all elements in the set of matched elements.
    transform(String transformer)
    Transform all elements in the set of matched elements.
    transform(URL transformer)
    Transform all elements in the set of matched elements.
    transform(Source transformer)
    Transform all elements in the set of matched elements.
    transform(Transformer transformer)
    Transform all elements in the set of matched elements.
    <T> List<T>
    unmarshal(Class<T> type)
    Unmarshal the current set of matched elements into a JAXB-annotated type.
    <T> List<T>
    unmarshal(Class<T> type, int... indexes)
    Unmarshal the current set of matched elements at given indexes into a JAXB-annotated type.
    <T> T
    Unmarshal the first element in the current set of matched elements into a JAXB-annotated type.
    <T> T
    unmarshalOne(Class<T> type, int index)
    Unmarshal the element at a given index in the current set of matched elements into a JAXB-annotated type.
    Removes all elements in the set of matched elements from their parents
    wrap(String parent)
    Wrap all elements from their parent nodes in the set of matched elements in a new parent element
    wrap(Content parent)
    Wrap all elements in the set of matched elements in a new parent element
    write(File file)
    Write the set of matched elements into a file
    Write the set of matched elements into a stream
    write(Writer writer)
    Write the set of matched elements into a writer
    Get an XPath expression describing the first element in the current set of matched elements
    xpath(int index)
    Get an XPath expression describing the element at a given index in the current set of matched elements
    xpath(String expression)
    Match all elements given a certain XPath expression applied to each element in the current set of matched elements.
    xpath(String expression, Object... variables)
    Match all elements given a certain XPath expression applied to each element in the current set of matched elements.
    Get a list of XPath expressions describing the elements in the current set of matched elements
    xpaths(int... indexes)
    Get a list of XPath expressions describing the elements at the given indexes in the current set of matched elements

    Methods inherited from interface java.lang.Iterable

    forEach, iterator, spliterator
  • Method Details

    • namespace

      Match namespace(String namespacePrefix, String namespaceURI)
      Get a new Match with added namespace configuration for subsequent XPath calls

      This is a convenience method for namespaces(java.util.Map)

      Parameters:
      namespacePrefix - A namespace prefix
      namespaceURI - A namespace URI
      Returns:
      A modified Match
      See Also:
    • namespaces

      Match namespaces(Map<String,String> map)
      Get a new Match with added namespace configuration for subsequent XPath calls
      Parameters:
      map - A mapping between prefix and namespace URI
      Returns:
      A modified Match
    • namespaceURIs

      List<String> namespaceURIs()
      Get a list of namespace URIs of the elements in the current set of matched elements.

      This only works if the underlying document is namespace-aware

      See Also:
    • namespaceURIs

      List<String> namespaceURIs(int... indexes)
      Get a list of namespace URIs of the elements at given indexes in the current set of matched elements.

      This only works if the underlying document is namespace-aware

      See Also:
    • namespaceURI

      String namespaceURI()
      Get the namespace URI of the first element in the current set of matched elements.

      This is the same as calling namespaceURI(0)

      This only works if the underlying document is namespace-aware

      See Also:
    • namespaceURI

      String namespaceURI(int index)
      Get a namespace URI of the element at a given index in the current set of matched elements.

      This only works if the underlying document is namespace-aware

      See Also:
    • namespacePrefixes

      List<String> namespacePrefixes()
      Get a list of namespace prefixes of the elements in the current set of matched elements.
    • namespacePrefixes

      List<String> namespacePrefixes(int... indexes)
      Get a list of namespace prefixes of the elements at given indexes in the current set of matched elements.
    • namespacePrefix

      String namespacePrefix()
      Get the namespace prefix of the first element in the current set of matched elements.

      This is the same as calling namespaceURI(0)

    • namespacePrefix

      String namespacePrefix(int index)
      Get a namespace prefix of the element at a given index in the current set of matched elements.
    • get

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

      Negative indexes are possible, too.

      • -1 corresponds to the last element in the set of matched elements.
      • -2 corresponds to the second-last element, etc.
    • document

      Document document()
      Get the underlying document of the set of matched elements.

      This will also return a document if there are no elements in the set of matched elements, either because a new document has been created previously, or the set of matched elements has been reduced to an empty set.

    • get

      List<Element> get(int... indexes)
      Get some elements from the set of matched elements at the given indexes

      Negative indexes are possible, too.

      • -1 corresponds to the last element in the set of matched elements.
      • -2 corresponds to the second-last element, etc.
    • 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
    • isEmpty

      boolean isEmpty()
      Whether there are any matched elements in the set of matched elements
    • isNotEmpty

      boolean isNotEmpty()
      Whether there are any matched elements in the set of matched elements
    • add

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

      Match add(Match... elements)
      Add some elements to the set of matched elements
    • reverse

      Match reverse()
      Reverse the order of the set of matched elements
    • andSelf

      Match andSelf()
      Add the previous set of matched elements to the current one. This works after any of these methods (including all overloaded variants): In all other cases, this just returns the same match this was called upon. For instance, it does not make sense to first reduce a set of matched elements using eq(int...), and then add the removed elements again, using andSelf().
    • child

      Match child()
      Find the first child of each element in the current set of matched elements.

      This is the same as calling child(0).

    • child

      Match child(String selector)
      Find the first matching child of each element in the current set of matched elements

      The selector provided to this method supports the following features:

      • * can be used to select everything
      • tag names can be used to select XML elements by tag names (see Element.getElementsByTagName(String). Tag names are namespace-unaware. This means that existing namespaces will be ignored
      The following features are not supported:
      See Also:
    • child

      Match child(Filter filter)
      Find the first matching child of each element in the current set of matched elements
    • child

      Match child(int index)
      Find the child at a given index of each element in the current set of matched elements.
    • children

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

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

      The selector provided to this method supports the following features:

      • * can be used to select everything
      • tag names can be used to select XML elements by tag names (see Element.getElementsByTagName(String). Tag names are namespace-unaware. This means that existing namespaces will be ignored
      The following features are not supported:
      See Also:
    • children

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

      The callback Context is populated like this:

    • children

      Match children(int... indexes)
      Find all children of each element at given indexes in the current set of matched elements.
    • each

      List<Match> each()
      Get all elements in the set of matched elements in a list of matches, every match representing one element
    • each

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

      Match each(Each... each)
      Execute several callbacks for every element in the current set of matched elements.
      See Also:
    • each

      Match each(Iterable<? extends Each> each)
      Execute several callbacks for every element in the current set of matched elements.
      See Also:
    • filter

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

      The selector provided to this method supports the following features:

      • * can be used to select everything
      • tag names can be used to select XML elements by tag names (see Element.getElementsByTagName(String). Tag names are namespace-unaware. This means that existing namespaces will be ignored
      The following features are not supported:
      See Also:
    • filter

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

      The callback Context is populated like this:

    • eq

      Match eq(int... indexes)
      Reduce the current set of matched elements to the elements at the given indexes. If the given indexes are not in the range of indexes, the resulting set will be empty.

      Negative indexes are possible, too.

      • -1 corresponds to the last element in the set of matched elements.
      • -2 corresponds to the second-last element, etc.
    • find

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

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

      The selector provided to this method supports the following features:

      • * can be used to select everything
      • tag names can be used to select XML elements by tag names (see Element.getElementsByTagName(String) Tag names are namespace-unaware. This means that existing namespaces will be ignored
      • CSS selectors can be used to select XML elements using XPath (see CSS2XPath.css2xpath(String))
      The following features are not supported:
      See Also:
    • find

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

      The callback Context is populated like this:

    • xpath

      Match xpath(String expression)
      Match all elements given a certain XPath expression applied to each element in the current set of matched elements.

      The XPath expression is evaluated using standard XPath. It must not contain any variables. Use xpath(String, Object...) instead, if you wish to use variables. Note that only matched elements will be considered in the results. You cannot match attributes or text nodes, for instance. Examples:

      • Match all elements : xpath("//*")
      • Match all books : xpath("/library/books/book")
      • Match all book ID's : xpath("//book").ids()
      • Match all book names : xpath("//book/name").texts()
      This doesn't work (not matching elements):
      • Match all book ID's : xpath("//book/@id")
      • Match all book names : xpath("//book/name/text()")

      Using jOOX with Namespaces

      Namespace declarations are supported in XPath expressions. If you wish to use namespace-specific XPath elements, call namespace(String, String) prior to xpath(String)

      Using jOOX with Xalan

      If Xalan is on your classpath, jOOX will automatically load xalan's namespace and function extensions. All functionality supported by http://exslt.org will be available in your XPath expressions. Some examples:

      • Match the book with the highest ID : xpath("//book[number(@id) = math:max(//book/@id)]")
      • Match books written by Orwell : xpath("//book[java:org.joox.test.Functions.byOrwellWithNodes(.)]
    • xpath

      Match xpath(String expression, Object... variables)
      Match all elements given a certain XPath expression applied to each element in the current set of matched elements.

      The XPath expression is evaluated using standard XPath. It may contain numerical variables, declared as $1, $2, etc, starting with $1. Other variables, such as $myVar are not supported. You must provide at least one variable in the variables argument for every variable index. Note that only matched elements will be considered in the results. You cannot match attributes or text nodes, for instance. Examples:

      • Match all elements with id greater than 5: xpath("//*[@id > $1]", 5)
      • Match all books with more than two authors and one author is "George Orwell" : xpath("/library/books/book[count(authors/author) > $1][authors/author[text() = $2]]", 2, "George Orwell")
      This doesn't work (not matching elements):
      • Match all book ID's : xpath("//book/@id")
      • Match all book names : xpath("//book/name/text()")

      Using jOOX with Namespaces

      Namespace declarations are supported in XPath expressions. If you wish to use namespace-specific XPath elements, call namespace(String, String) prior to xpath(String)

      Using jOOX with Xalan

      If Xalan is on your classpath, jOOX will automatically load xalan's namespace and function extensions. All functionality supported by http://exslt.org will be available in your XPath expressions. Some examples:

      • Match the book with the highest ID : xpath("//book[number(@id) = math:max(//book/@id)]")
      • Match books written by Orwell : xpath("//book[java:org.joox.test.Functions.byOrwellWithNodes(.)]
    • first

      Match first()
      Get the first in a set of matched elements.
    • has

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

      The selector provided to this method supports the following features:

      • * can be used to select everything
      • tag names can be used to select XML elements by tag names (see Element.getElementsByTagName(String). Tag names are namespace-unaware. This means that existing namespaces will be ignored
      The following features are not supported:
      See Also:
    • has

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

      The callback Context is populated like this:

    • is

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

      The selector provided to this method supports the following features:

      • * can be used to select everything
      • tag names can be used to select XML elements by tag names (see Element.getElementsByTagName(String). Tag names are namespace-unaware. This means that existing namespaces will be ignored
      The following features are not supported:
      See Also:
    • is

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

      The callback Context is populated like this:

    • last

      Match 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

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

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

      The selector provided to this method supports the following features:

      • * can be used to select everything
      • tag names can be used to select XML elements by tag names (see Element.getElementsByTagName(String). Tag names are namespace-unaware. This means that existing namespaces will be ignored
      The following features are not supported:
      See Also:
    • next

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

      The callback Context is populated like this:

    • nextAll

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

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

      The selector provided to this method supports the following features:

      • * can be used to select everything
      • tag names can be used to select XML elements by tag names (see Element.getElementsByTagName(String). Tag names are namespace-unaware. This means that existing namespaces will be ignored
      The following features are not supported:
      See Also:
    • nextAll

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

      The callback Context is populated like this:

    • nextUntil

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

      The selector provided to this method supports the following features:

      • * can be used to select everything
      • tag names can be used to select XML elements by tag names (see Element.getElementsByTagName(String). Tag names are namespace-unaware. This means that existing namespaces will be ignored
      The following features are not supported:
      See Also:
    • nextUntil

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

      The callback Context is populated like this:

    • nextUntil

      Match 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

      The selector provided to this method supports the following features:

      • * can be used to select everything
      • tag names can be used to select XML elements by tag names (see Element.getElementsByTagName(String). Tag names are namespace-unaware. This means that existing namespaces will be ignored
      The following features are not supported:
      See Also:
    • nextUntil

      Match 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

      The callback Context is populated like this:

      See Also:
    • nextUntil

      Match 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

      The callback Context is populated like this:

      See Also:
    • nextUntil

      Match 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

      The callback Context is populated like this:

      See Also:
    • not

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

      The selector provided to this method supports the following features:

      • * can be used to select everything
      • tag names can be used to select XML elements by tag names (see Element.getElementsByTagName(String). Tag names are namespace-unaware. This means that existing namespaces will be ignored
      The following features are not supported:
      See Also:
    • not

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

      The callback Context is populated like this:

    • parent

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

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

      The selector provided to this method supports the following features:

      • * can be used to select everything
      • tag names can be used to select XML elements by tag names (see Element.getElementsByTagName(String). Tag names are namespace-unaware. This means that existing namespaces will be ignored
      The following features are not supported:
      See Also:
    • parent

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

      The callback Context is populated like this:

    • parents

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

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

      The selector provided to this method supports the following features:

      • * can be used to select everything
      • tag names can be used to select XML elements by tag names (see Element.getElementsByTagName(String). Tag names are namespace-unaware. This means that existing namespaces will be ignored
      The following features are not supported:
      See Also:
    • parents

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

      The callback Context is populated like this:

    • parentsUntil

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

      The selector provided to this method supports the following features:

      • * can be used to select everything
      • tag names can be used to select XML elements by tag names (see Element.getElementsByTagName(String). Tag names are namespace-unaware. This means that existing namespaces will be ignored
      The following features are not supported:
      See Also:
    • parentsUntil

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

      The callback Context is populated like this:

    • parentsUntil

      Match 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

      The selector provided to this method supports the following features:

      • * can be used to select everything
      • tag names can be used to select XML elements by tag names (see Element.getElementsByTagName(String). Tag names are namespace-unaware. This means that existing namespaces will be ignored
      The following features are not supported:
      See Also:
    • parentsUntil

      Match 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

      The callback Context is populated like this:

      See Also:
    • parentsUntil

      Match 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

      The callback Context is populated like this:

      See Also:
    • parentsUntil

      Match 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

      The callback Context is populated like this:

    • prev

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

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

      The selector provided to this method supports the following features:

      • * can be used to select everything
      • tag names can be used to select XML elements by tag names (see Element.getElementsByTagName(String). Tag names are namespace-unaware. This means that existing namespaces will be ignored
      The following features are not supported:
      See Also:
    • prev

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

      The callback Context is populated like this:

    • prevAll

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

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

      The selector provided to this method supports the following features:

      • * can be used to select everything
      • tag names can be used to select XML elements by tag names (see Element.getElementsByTagName(String). Tag names are namespace-unaware. This means that existing namespaces will be ignored
      The following features are not supported:
      See Also:
    • prevAll

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

      The callback Context is populated like this:

    • prevUntil

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

      The selector provided to this method supports the following features:

      • * can be used to select everything
      • tag names can be used to select XML elements by tag names (see Element.getElementsByTagName(String). Tag names are namespace-unaware. This means that existing namespaces will be ignored
      The following features are not supported:
      See Also:
    • prevUntil

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

      The callback Context is populated like this:

    • prevUntil

      Match 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

      The selector provided to this method supports the following features:

      • * can be used to select everything
      • tag names can be used to select XML elements by tag names (see Element.getElementsByTagName(String). Tag names are namespace-unaware. This means that existing namespaces will be ignored
      The following features are not supported:
      See Also:
    • prevUntil

      Match 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

      The callback Context is populated like this:

      See Also:
    • prevUntil

      Match 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

      The callback Context is populated like this:

      See Also:
    • prevUntil

      Match 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

      The callback Context is populated like this:

    • siblings

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

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

      The selector provided to this method supports the following features:

      • * can be used to select everything
      • tag names can be used to select XML elements by tag names (see Element.getElementsByTagName(String). Tag names are namespace-unaware. This means that existing namespaces will be ignored
      The following features are not supported:
      See Also:
    • siblings

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

      The callback Context is populated like this:

    • slice

      Match 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

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

      Match matchText(String regex)
      Reduce the set of matched elements by filtering out those whose text content doesn't match a given regex

      This is the same as calling matchText(regex, true)

      See Also:
    • matchText

      Match matchText(String regex, boolean keepMatches)
      Reduce the set of matched elements by filtering out those whose text content doesn't match a given regex (keepMatches = true), or those whose text content matches a given regex (keepMatches = false)
      See Also:
    • matchAttr

      Match matchAttr(String name, String valueRegex)
      Reduce the set of matched elements by filtering out those whose attribute content doesn't match a given regex

      This is the same as calling matchAttr(name, valueRegex, true)

      See Also:
    • matchAttr

      Match matchAttr(String name, String valueRegex, boolean keepMatches)
      Reduce the set of matched elements by filtering out those whose attribute content doesn't match a given regex (keepMatches = true), or those whose text content matches a given regex (keepMatches = false)
      See Also:
    • matchTag

      Match matchTag(String regex)
      Reduce the set of matched elements by filtering out those whose tag name doesn't match a given regex

      This is the same as calling matchText(regex, true)

      See Also:
    • matchTag

      Match matchTag(String regex, boolean keepMatches)
      Reduce the set of matched elements by filtering out those whose tag name doesn't match a given regex (keepMatches = true), or those whose tag name matches a given regex (keepMatches = false)
      See Also:
    • leaf

      Match leaf()
      Reduce the set of matched elements to the ones that are leaf elements
      See Also:
    • before

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

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

      The callback Context is populated like this:

    • before

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

      If the added content is already contained in this document, then it is moved. Otherwise, it is cloned. If there are several elements in the set of matched elements, then the added content is duplicated.

    • before

      Match before(Element... content)
      Add content before each element in the set of matched elements.

      If the added content is already contained in this document, then it is moved. Otherwise, it is cloned. If there are several elements in the set of matched elements, then the added content is duplicated.

    • after

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

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

      The callback Context is populated like this:

    • after

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

      If the added content is already contained in this document, then it is moved. Otherwise, it is cloned. If there are several elements in the set of matched elements, then the added content is duplicated.

    • after

      Match after(Element... content)
      Add content after each element in the set of matched elements.

      If the added content is already contained in this document, then it is moved. Otherwise, it is cloned. If there are several elements in the set of matched elements, then the added content is duplicated.

    • prepend

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

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

      The callback Context is populated like this:

    • prepend

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

      If the added content is already contained in this document, then it is moved. Otherwise, it is cloned. If there are several elements in the set of matched elements, then the added content is duplicated.

    • prepend

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

      If the added content is already contained in this document, then it is moved. Otherwise, it is cloned. If there are several elements in the set of matched elements, then the added content is duplicated.

    • append

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

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

      The callback Context is populated like this:

    • append

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

      If the added content is already contained in this document, then it is moved. Otherwise, it is cloned. If there are several elements in the set of matched elements, then the added content is duplicated.

    • append

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

      If the added content is already contained in this document, then it is moved. Otherwise, it is cloned. If there are several elements in the set of matched elements, then the added content is duplicated.

    • replaceWith

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

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

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

      If the added content is already contained in this document, then it is moved. Otherwise, it is cloned. If there are several elements in the set of matched elements, then the added content is duplicated.

    • replaceWith

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

      If the added content is already contained in this document, then it is moved. Otherwise, it is cloned. If there are several elements in the set of matched elements, then the added content is duplicated.

    • rename

      Match rename(String tag)
      Rename all tags in the set of matched elements to some new tag name
    • rename

      Match rename(Content tag)
      Rename all tags in the set of matched elements to some new tag name
    • empty

      Match empty()
      Removes all content from all elements in the set of matched elements.
    • remove

      Match remove()
      Removes all elements from their parent nodes in the set of matched elements.
    • remove

      Match remove(String selector)
      Removes all elements from their parent nodes in the set of matched elements, matching a selector

      The selector provided to this method supports the following features:

      • * can be used to select everything
      • tag names can be used to select XML elements by tag names (see Element.getElementsByTagName(String). Tag names are namespace-unaware. This means that existing namespaces will be ignored
      The following features are not supported:
      See Also:
    • remove

      Match remove(Filter filter)
      Removes all elements from their parent nodes in the set of matched elements, matching a filter

      The callback Context is populated like this:

    • wrap

      Match wrap(String parent)
      Wrap all elements from their parent nodes in the set of matched elements in a new parent element

      The resulting set of matched elements contains the newly wrapped elements

      See Also:
    • wrap

      Match wrap(Content parent)
      Wrap all elements in the set of matched elements in a new parent element

      The resulting set of matched elements contains the newly wrapped elements

      See Also:
    • unwrap

      Match unwrap()
      Removes all elements in the set of matched elements from their parents

      The resulting set of matched elements contains the newly unwrapped elements

      See Also:
    • attrNames

      Set<String> attrNames()
      Get the set of available attribute names in the set of matched elements.
    • attr

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

      jOOX is namespace-unaware. The supplied attribute name will be compared against all attributes, matching the first one that has the given name.

    • attr

      <T> T attr(String name, Class<T> type)
      Get a converted attribute from the first element in the set of matched elements, or null if the first element does not have that attribute.

      jOOX is namespace-unaware. The supplied attribute name will be compared against all attributes, matching the first one that has the given name.

      See Also:
    • attrs

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

      jOOX is namespace-unaware. The supplied attribute name will be compared against all attributes, matching the first one that has the given name.

    • attrs

      <T> List<T> attrs(String name, Class<T> type)
      Get a converted attribute from all elements in the set of matched elements

      jOOX is namespace-unaware. The supplied attribute name will be compared against all attributes, matching the first one that has the given name.

      See Also:
    • attr

      Match 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

      Match 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.

      The callback Context is populated like this:

    • removeAttr

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

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

      List<String> contents(int... indexes)
      Get all XML content of the elements at given indexes in the set of matched elements.
    • 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.

      This is the same as calling content(0)

    • content

      String content(int index)
      Get the XML content at a given index in the current set of matched elements.
    • content

      Match 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

      Match content(Object content)
      Add some JAXB-marshallable XML content to all elements in the set of matched elements (possibly replacing existing content).
      See Also:
    • content

      Match 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)

      The callback Context is populated like this:

    • texts

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

      <T> List<T> texts(Class<T> type)
      Get all converted text content of the elements in the set of matched elements.
      See Also:
    • texts

      List<String> texts(int... indexes)
      Get all text content of the elements at given indexes in the set of matched elements.
    • 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.

      This is the same as calling text(0)

    • text

      <T> T text(Class<T> type)
      Get the converted text content of the first element in the set of matched elements, or null if there are no matched elements.
      See Also:
    • text

      String text(int index)
      Get the text content at a given index in the current set of matched elements.
    • text

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

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

      The callback Context is populated like this:

    • cdatas

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

      This is the same as texts().

    • cdatas

      <T> List<T> cdatas(Class<T> type)
      Get all converted CDATA content of the elements in the set of matched elements.

      This is the same as texts(Class).

      See Also:
    • cdatas

      List<String> cdatas(int... indexes)
      Get all CDATA content of the elements at given indexes in the set of matched elements.

      This is the same as texts(int...).

    • cdata

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

      This is the same as calling cdata(0) or text().

    • cdata

      <T> T cdata(Class<T> type)
      Get the converted CDATA content of the first element in the set of matched elements, or null if there are no matched elements.

      This is the same as text(Class).

      See Also:
    • cdata

      String cdata(int index)
      Get the CDATA content at a given index in the current set of matched elements.

      This is the same as text(int).

    • cdata

      Match cdata(String content)
      Set some CDATA content to all elements in the set of matched elements (possibly replacing existing content).

      Unlike text(Content), this generates a Node.CDATA_SECTION_NODE.

    • cdata

      Match cdata(Content content)
      Set some CDATA content to all elements in the set of matched elements (possibly replacing existing content).

      The callback Context is populated like this:

      Unlike text(Content), this generates a Node.CDATA_SECTION_NODE.

    • copy

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

      List<String> xpaths()
      Get a list of XPath expressions describing the elements in the current set of matched elements
    • xpaths

      List<String> xpaths(int... indexes)
      Get a list of XPath expressions describing the elements at the given indexes in the current set of matched elements
    • xpath

      String xpath()
      Get an XPath expression describing the first element in the current set of matched elements

      This is the same as calling xpath(0)

    • xpath

      String xpath(int index)
      Get an XPath expression describing the element at a given index in the current set of matched elements
    • tags

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

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

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

      This is the same as calling tag(0)

    • tag

      String tag(int index)
      Get a tag name of the element at a given index in the current set of matched elements.
    • 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")

    • ids

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

      <T> List<T> ids(Class<T> type)
      Get a list of converted id values in the current set of matched elements.
      See Also:
    • id

      String id()
      Get the first id value

      This is the same as calling id(0)

    • id

      String id(int index)
      Get an id value at a given index in the current set of matched elements.

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

    • id

      <T> T id(Class<T> type)
      Get the first converted id value
      See Also:
    • write

      Match write(Writer writer) throws IOException
      Write the set of matched elements into a writer

      If the set contains more or less than 1 element, this will result in writing non-well-formed XML

      Throws:
      IOException
    • write

      Match write(OutputStream stream) throws IOException
      Write the set of matched elements into a stream

      If the set contains more or less than 1 element, this will result in writing non-well-formed XML

      Throws:
      IOException
    • write

      Match write(File file) throws IOException
      Write the set of matched elements into a file

      If the set contains more or less than 1 element, this will result in writing non-well-formed XML

      Throws:
      IOException
    • unmarshal

      <T> List<T> unmarshal(Class<T> type)
      Unmarshal the current set of matched elements into a JAXB-annotated type.
    • unmarshal

      <T> List<T> unmarshal(Class<T> type, int... indexes)
      Unmarshal the current set of matched elements at given indexes into a JAXB-annotated type.
    • unmarshalOne

      <T> T unmarshalOne(Class<T> type)
      Unmarshal the first element in the current set of matched elements into a JAXB-annotated type.

      This is the same as calling unmarshalOne(type, 0)

    • unmarshalOne

      <T> T unmarshalOne(Class<T> type, int index)
      Unmarshal the element at a given index in the current set of matched elements into a JAXB-annotated type.

      This is the same as calling unmarshalOne(type, 0)

    • transform

      Match transform(Transformer transformer)
      Transform all elements in the set of matched elements.

      This will apply a given Transformer to every element in the set of matched elements. Every element in the set of matched elements will be replaced by its corresponding Result obtained from the transformer.

      Example Input:

       <books>
         <book id="1"/>
         <book id="2"/>
       </books>
       

      Example XSLT:

       <?xml version="1.0" encoding="ISO-8859-1"?>
       <xsl:stylesheet version="1.0"
           xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
      
           <xsl:template match="book">
               <book id="">
                   <xsl:apply-templates/>
               </book>
           </xsl:template>
      
           <xsl:template match="@*|*">
               <xsl:copy>
                   <xsl:apply-templates select="*|@*"/>
               </xsl:copy>
           </xsl:template>
       </xsl:stylesheet>
       

      Apply transformation:

       // Applies transformation to the document element:
       $(document).transform("increment.xsl");
      
       // Applies transformation to every book element:
       $(document).find("book").transform("increment.xsl");
       

      Result:

       <books>
         <book id="2"/>
         <book id="3"/>
       </books>
       
    • transform

      Match transform(Source transformer)
      Transform all elements in the set of matched elements.
      See Also:
    • transform

      Match transform(InputStream transformer)
      Transform all elements in the set of matched elements.
      See Also:
    • transform

      Match transform(Reader transformer)
      Transform all elements in the set of matched elements.
      See Also:
    • transform

      Match transform(URL transformer)
      Transform all elements in the set of matched elements.
      See Also:
    • transform

      Match transform(File transformer)
      Transform all elements in the set of matched elements.
      See Also:
    • transform

      Match transform(String transformer)
      Transform all elements in the set of matched elements.
      See Also:
    • sort

      Match sort(Comparator<Element> comparator)
      Allows to sort the result with the given comparator.
      Parameters:
      comparator - The element comparator.
      Returns: