Class Impl
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate classA namespace context that is aware of this Impl's configured namespaces, as well as a chained context.private static classA simple variable resolver mapping variable names to their respective index in an XPath expression. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal ImplAdd some elements to the set of matched elementsfinal ImplAdd some elements to the set of matched elements(package private) final Impl(package private) final ImpladdElements(Element... e) (package private) final ImpladdNodeList(NodeList list) (package private) final ImpladdNodeLists(List<NodeList> lists) (package private) final Impl(package private) final ImpladdUniqueElements(Element... e) final ImplAdd content after each element in the set of matched elements.final ImplAdd content after each element in the set of matched elements.final ImplAdd content after each element in the set of matched elements.final ImplAdd content after each element in the set of matched elements.final ImplandSelf()Add the previous set of matched elements to the current one.final ImplAppend content to the end of each element's content in the set of matched elements.final ImplAppend content to the end of each element's content in the set of matched elements.final ImplAppend content to the end of each element's content in the set of matched elements.final ImplAppend content to the end of each element's content in the set of matched elements.final StringGet an attribute from the first element in the set of matched elements, ornullif the first element does not have that attribute.final <T> TGet a converted attribute from the first element in the set of matched elements, ornullif the first element does not have that attribute.final ImplSet an attribute on all elements in the set of matched elements.final ImplSet an attribute on all elements in the set of matched elements.Get an attribute from all elements in the set of matched elementsfinal <T> List<T> Get a converted attribute from all elements in the set of matched elementsprivate final Implaxis(boolean all, Filter until, Filter filter, Function<Node, Node> iterate, Consumer<List<Element>> finisher) final ImplAdd content before each element in the set of matched elements.final ImplAdd content before each element in the set of matched elements.final ImplAdd content before each element in the set of matched elements.final ImplAdd content before each element in the set of matched elements.final Stringcdata()Get the CDATA content of the first element in the set of matched elements, ornullif there are no matched elements.final Stringcdata(int index) Get the CDATA content at a given index in the current set of matched elements.final <T> TGet the converted CDATA content of the first element in the set of matched elements, ornullif there are no matched elements.final ImplSet some CDATA content to all elements in the set of matched elements (possibly replacing existing content).final ImplSet some CDATA content to all elements in the set of matched elements (possibly replacing existing content).cdatas()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.final <T> List<T> Get all converted CDATA content of the elements in the set of matched elements.final Implchild()Find the first child of each element in the current set of matched elements.final Implchild(int index) Find the child at a given index of each element in the current set of matched elements.final ImplFind the first matching child of each element in the current set of matched elementsfinal ImplFind the first matching child of each element in the current set of matched elementsfinal Implchildren()Find all children of each element in the current set of matched elements.final Implchildren(int... indexes) Find all children of each element at given indexes in the current set of matched elements.final ImplFind all children of each element in the current set of matched elements.final ImplFind all children of each element in the current set of matched elements.final Stringcontent()Get the XML content of the first element in the set of matched elements, ornullif there are no matched elements.final Stringcontent(int index) Get the XML content at a given index in the current set of matched elements.final ImplAdd some JAXB-marshallable XML content to all elements in the set of matched elements (possibly replacing existing content).final ImplAdd some XML content to all elements in the set of matched elements (possibly replacing existing content).final ImplAdd some XML content to all elements in the set of matched elements (possibly replacing existing content).private final Stringcontents()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.final Implcopy()Get a copy of theMatchwrapper.final Documentdocument()Get the underlying document of the set of matched elements.each()Get all elements in the set of matched elements in a list of matches, every match representing one elementfinal ImplExecute several callbacks for every element in the current set of matched elements.final ImplExecute a callback for every element in the current set of matched elements.final ImplExecute several callbacks for every element in the current set of matched elements.final Matchempty()Removes all content from all elements in the set of matched elements.private final voidfinal Impleq(int... indexes) Reduce the current set of matched elements to the elements at the given indexes.booleanfinal ImplReduce the current set of matched elements.final ImplReduce the current set of matched elements.final Implfind()Find all descendants of each element in the current set of matched elements.final ImplFind all descendants of each element in the current set of matched elements.final ImplFind all descendants of each element in the current set of matched elements.final Implfirst()Get the first in a set of matched elements.get()Get an the set of matched elementsfinal Elementget(int index) Get an element from the set of matched elements at a given indexget(int... indexes) Get some elements from the set of matched elements at the given indexesfinal ImplReduce the set of matched element to those who have a descendant that matches a selector.final ImplReduce the set of matched element to those who have a descendant that matches a filter.inthashCode()final Stringid()Get the first id valuefinal Stringid(int index) Get an id value at a given index in the current set of matched elements.final <T> TGet the first converted id valueids()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.final <T> List<T> Get a list of converted id values in the current set of matched elements.final booleanCheck if at least one element in the set of matched elements satisfies a selector.final booleanCheck if at least one element in the set of matched elements satisfies a filter.final booleanisEmpty()Whether there are any matched elements in the set of matched elementsprivate final booleanfinal booleanWhether there are any matched elements in the set of matched elementsprivate booleanisRoot()Temporary utility method to indicate whether the root element is among the matched elementsiterator()final Impllast()Get the last in a set of matched elements.final Implleaf()Reduce the set of matched elements to the ones that are leaf elementsfinal <E> List<E> Map the set of matched elements to a list of somethingfinal MatchReduce the set of matched elements by filtering out those whose attribute content doesn't match a given regexfinal MatchReduce 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)final ImplReduce the set of matched elements by filtering out those whose tag name doesn't match a given regexfinal ImplReduce 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)final ImplReduce the set of matched elements by filtering out those whose text content doesn't match a given regexfinal ImplReduce 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)final MatchGet a new Match with added namespace configuration for subsequent XPath callsfinal StringGet the namespace prefix of the first element in the current set of matched elements.final StringnamespacePrefix(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.final Matchnamespaces(Map<String, String> map) Get a new Match with added namespace configuration for subsequent XPath callsfinal StringGet the namespace URI of the first element in the current set of matched elements.final StringnamespaceURI(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.final Implnext()Get the immediate next sibling of every element in set of matched elements.private final Implfinal ImplGet the immediate next sibling of every element in set of matched elements, matching a selectorfinal ImplGet the immediate next sibling of every element in set of matched elements, matching a filterfinal ImplnextAll()Get all next siblings of every element in a set of matched elementsfinal ImplGet all next siblings of every element in a set of matched elements, matching a selectorfinal ImplGet all next siblings of every element in a set of matched elements, matching a filterfinal ImplGet all next siblings of every element in a set of matched elements until the provided selector matchesfinal ImplGet all next siblings of every element in a set of matched elements, matching a selector, until the provided selector matchesfinal ImplGet all next siblings of every element in a set of matched elements, matching a filter, until the provided selector matchesfinal ImplGet all next siblings of every element in a set of matched elements until the provided filter matchesfinal ImplGet all next siblings of every element in a set of matched elements, matching a selector until the provided filter matchesfinal ImplGet all next siblings of every element in a set of matched elements, matching a filter until the provided filter matchesfinal ImplRemove elements from the set of matched elements.final ImplRemove elements from the set of matched elements.final Implparent()Get the immediate parent elements of every element in a set of matched elementsfinal ImplGet the immediate parent elements of every element in a set of matched elements, matching a selectorfinal ImplGet the immediate parent elements of every element in a set of matched elements, matching a filterfinal Implparents()Get all ancestor elements of every element in a set of matched elementsprivate final Implfinal ImplGet all ancestor elements of every element in a set of matched elements, matching a selectorfinal ImplGet all ancestor elements of every element in a set of matched elements, matching a filterfinal ImplparentsUntil(String until) Get all ancestors of every element in a set of matched elements until the provided selector matchesfinal ImplparentsUntil(String until, String selector) Get all ancestors of every element in a set of matched elements, matching a selector, until the provided selector matchesfinal ImplparentsUntil(String until, Filter filter) Get all ancestors of every element in a set of matched elements, matching a filter, until the provided selector matchesfinal ImplparentsUntil(Filter until) Get all ancestors of every element in a set of matched elements until the provided filter matchesfinal ImplparentsUntil(Filter until, String selector) Get all ancestors of every element in a set of matched elements, matching a selector until the provided filter matchesfinal ImplparentsUntil(Filter until, Filter filter) Get all ancestors of every element in a set of matched elements, matching a filter until the provided filter matchesfinal ImplPrepend content to the beginning of each element's content in the set of matched elements.final ImplPrepend content to the beginning of each element's content in the set of matched elements.final ImplPrepend content to the beginning of each element's content in the set of matched elements.final ImplPrepend content to the beginning of each element's content in the set of matched elements.final Implprev()Get the immediate previous sibling of every element in set of matched elements.private final Implfinal ImplGet the immediate previous sibling of every element in set of matched elements, matching a selectorfinal ImplGet the immediate previous sibling of every element in set of matched elements, matching a filterfinal ImplprevAll()Get all previous siblings of every element in a set of matched elementsfinal ImplGet all previous siblings of every element in a set of matched elements, matching a selectorfinal ImplGet all previous siblings of every element in a set of matched elements, matching a filterfinal ImplGet all previous siblings of every element in a set of matched elements until the provided selector matchesfinal ImplGet all previous siblings of every element in a set of matched elements, matching a selector, until the provided selector matchesfinal ImplGet all previous siblings of every element in a set of matched elements, matching a filter, until the provided selector matchesfinal ImplGet all previous siblings of every element in a set of matched elements until the provided filter matchesfinal ImplGet all previous siblings of every element in a set of matched elements, matching a selector until the provided filter matchesfinal ImplGet all previous siblings of every element in a set of matched elements, matching a filter until the provided filter matchesfinal Implremove()Removes all elements from their parent nodes in the set of matched elements.final ImplRemoves all elements from their parent nodes in the set of matched elements, matching a selectorfinal ImplRemoves all elements from their parent nodes in the set of matched elements, matching a filterprivate final voidfinal ImplremoveAttr(String name) Remove an attribute from all elements in the set of matched elements.final MatchRename all tags in the set of matched elements to some new tag namefinal MatchRename all tags in the set of matched elements to some new tag namefinal ImplreplaceWith(String content) Replace all elements in the set of matched elements with some new content.final ImplreplaceWith(Content content) Replace all elements in the set of matched elements with some new content.final ImplreplaceWith(Match... content) Replace all elements in the set of matched elements with some new content.final ImplreplaceWith(Element... content) Replace all elements in the set of matched elements with some new content.final Implreverse()Reverse the order of the set of matched elementsfinal Implsiblings()Get all siblings of every element in a set of matched elementsfinal ImplGet all siblings of every element in a set of matched elements, matching a selectorfinal ImplGet all siblings of every element in a set of matched elements, matching a filterfinal intsize()Get the number of matched elements in the set of matched elementsfinal Implslice(int start) Reduce the set of matched elements by specifying a range of indexesfinal Implslice(int start, int end) Reduce the set of matched elements by specifying a range of indexessort(Comparator<Element> comparator) Allows to sort the result with the given comparator.final Stringtag()Get the tag name of the first element in the current set of matched elements.final Stringtag(int index) Get a tag name of the element at a given index in the current set of matched elements.tags()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.final Stringtext()Get the text content of the first element in the set of matched elements, ornullif there are no matched elements.final Stringtext(int index) Get the text content at a given index in the current set of matched elements.final <T> TGet the converted text content of the first element in the set of matched elements, ornullif there are no matched elements.final ImplSet some text content to all elements in the set of matched elements (possibly replacing existing content).final ImplSet some text content to all elements in the set of matched elements (possibly replacing existing content).texts()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.final <T> List<T> Get all converted text content of the elements in the set of matched elements.toString()final ImplTransform all elements in the set of matched elements.final Impltransform(InputStream transformer) Transform all elements in the set of matched elements.final ImplTransform all elements in the set of matched elements.final ImplTransform all elements in the set of matched elements.final ImplTransform all elements in the set of matched elements.final ImplTransform all elements in the set of matched elements.final Impltransform(Transformer transformer) Transform all elements in the set of matched elements.final <T> List<T> Unmarshal the current set of matched elements into a JAXB-annotated type.final <T> List<T> Unmarshal the current set of matched elements at given indexes into a JAXB-annotated type.final <T> TunmarshalOne(Class<T> type) Unmarshal the first element in the current set of matched elements into a JAXB-annotated type.final <T> TunmarshalOne(Class<T> type, int index) Unmarshal the element at a given index in the current set of matched elements into a JAXB-annotated type.final Implunwrap()Removes all elements in the set of matched elements from their parentsfinal ImplWrap all elements from their parent nodes in the set of matched elements in a new parent elementfinal ImplWrap all elements in the set of matched elements in a new parent elementfinal MatchWrite the set of matched elements into a filefinal Matchwrite(OutputStream stream) Write the set of matched elements into a streamfinal MatchWrite the set of matched elements into a writerfinal Stringxpath()Get an XPath expression describing the first element in the current set of matched elementsfinal Stringxpath(int index) Get an XPath expression describing the element at a given index in the current set of matched elementsfinal ImplMatch all elements given a certain XPath expression applied to each element in the current set of matched elements.final ImplMatch all elements given a certain XPath expression applied to each element in the current set of matched elements.xpaths()Get a list of XPath expressions describing the elements in the current set of matched elementsxpaths(int... indexes) Get a list of XPath expressions describing the elements at the given indexes in the current set of matched elementsMethods inherited from interface Iterable
forEach, spliterator
-
Field Details
-
document
-
elements
-
previousMatch
-
namespaces
-
SIMPLE_SELECTOR
A selector pattern that can be evaluated using standard DOM API
-
-
Constructor Details
-
Impl
-
Impl
-
-
Method Details
-
addNodeLists
-
addNodeList
-
addUniqueElements
-
addUniqueElements
-
addElements
-
addElements
-
iterator
-
namespace
Description copied from interface:MatchGet a new Match with added namespace configuration for subsequent XPath callsThis is a convenience method for
Match.namespaces(java.util.Map) -
namespaces
Description copied from interface:MatchGet a new Match with added namespace configuration for subsequent XPath calls- Specified by:
namespacesin interfaceMatch- Parameters:
map- A mapping between prefix and namespace URI- Returns:
- A modified
Match
-
namespaceURI
Description copied from interface:MatchGet 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
- Specified by:
namespaceURIin interfaceMatch- See Also:
-
namespaceURI
Description copied from interface:MatchGet 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
- Specified by:
namespaceURIin interfaceMatch- See Also:
-
namespaceURIs
Description copied from interface:MatchGet 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
- Specified by:
namespaceURIsin interfaceMatch- See Also:
-
namespaceURIs
Description copied from interface:MatchGet 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
- Specified by:
namespaceURIsin interfaceMatch- See Also:
-
namespacePrefix
Description copied from interface:MatchGet the namespace prefix of the first element in the current set of matched elements.This is the same as calling
namespaceURI(0)- Specified by:
namespacePrefixin interfaceMatch
-
namespacePrefix
Description copied from interface:MatchGet a namespace prefix of the element at a given index in the current set of matched elements.- Specified by:
namespacePrefixin interfaceMatch
-
namespacePrefixes
Description copied from interface:MatchGet a list of namespace prefixes of the elements in the current set of matched elements.- Specified by:
namespacePrefixesin interfaceMatch
-
namespacePrefixes
Description copied from interface:MatchGet a list of namespace prefixes of the elements at given indexes in the current set of matched elements.- Specified by:
namespacePrefixesin interfaceMatch
-
document
Description copied from interface:MatchGet 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
Description copied from interface:MatchGet an element from the set of matched elements at a given indexNegative indexes are possible, too.
-
-1corresponds to the last element in the set of matched elements. -
-2corresponds to the second-last element, etc.
-
-
get
Description copied from interface:MatchGet some elements from the set of matched elements at the given indexesNegative indexes are possible, too.
-
-1corresponds to the last element in the set of matched elements. -
-2corresponds to the second-last element, etc.
-
-
get
-
size
-
isEmpty
-
isNotEmpty
public final boolean isNotEmpty()Description copied from interface:MatchWhether there are any matched elements in the set of matched elements- Specified by:
isNotEmptyin interfaceMatch
-
add
-
add
-
reverse
-
andSelf
Description copied from interface:MatchAdd the previous set of matched elements to the current one. This works after any of these methods (including all overloaded variants):Match.child()Match.children()Match.find()Match.next()Match.nextAll()Match.nextUntil(Filter)Match.parent()Match.parents()Match.parentsUntil(Filter)Match.prev()Match.prevAll()Match.prevUntil(Filter)Match.siblings()
Match.eq(int...), and then add the removed elements again, usingMatch.andSelf(). -
child
-
child
Description copied from interface:MatchFind the first matching child of each element in the current set of matched elementsThe 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 cannot be used (yet) to select XML
elements from this method. Use
Match.find(String)instead - XPath cannot be used. Use
Match.xpath(String)instead - Namespaces cannot be used. Use
Match.xpath(String)withMatch.namespaces(Map)instead
-
child
-
child
-
children
-
children
-
children
Description copied from interface:MatchFind 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
- CSS selectors cannot be used (yet) to select XML
elements from this method. Use
Match.find(String)instead - XPath cannot be used. Use
Match.xpath(String)instead - Namespaces cannot be used. Use
Match.xpath(String)withMatch.namespaces(Map)instead
-
children
Description copied from interface:MatchFind all children of each element in the current set of matched elements.The callback
Contextis populated like this:-
Context.match()- the matched element whose children are searched -
Context.matchIndex()- the index of the matched element whose children are searched -
Context.element()- the child candidate that is being filtered -
Context.elementIndex()- the index within its parent of the child candidate that is being filtered
-
-
each
-
each
-
each
-
each
-
filter
Description copied from interface:MatchReduce 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 cannot be used (yet) to select XML
elements from this method. Use
Match.find(String)instead - XPath cannot be used. Use
Match.xpath(String)instead - Namespaces cannot be used. Use
Match.xpath(String)withMatch.namespaces(Map)instead
-
filter
Description copied from interface:MatchReduce the current set of matched elements.The callback
Contextis populated like this:-
Context.match()- the matched element being filtered -
Context.matchIndex()- the index of the matched element being filtered
-
-
filter0
-
eq
Description copied from interface:MatchReduce 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.
-
-1corresponds to the last element in the set of matched elements. -
-2corresponds to the second-last element, etc.
-
-
find
-
find
Description copied from interface:MatchFind 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))
- XPath cannot be used. Use
Match.xpath(String)instead - Namespaces cannot be used. Use
Match.xpath(String)withMatch.namespaces(Map)instead
-
isRoot
private boolean isRoot()Temporary utility method to indicate whether the root element is among the matched elements -
find
Description copied from interface:MatchFind all descendants of each element in the current set of matched elements.The callback
Contextis populated like this:-
Context.match()- the matched element whose descendants are searched -
Context.matchIndex()- the index of the matched element whose descendants are searched -
Context.element()- the descendant candidate that is being filtered -
Context.elementIndex()- the iteration index of the descendant candidate that is being filtered
-
-
xpath
Description copied from interface:MatchMatch 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. UseMatch.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()
- 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
Match.namespace(String, String)prior toMatch.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(.)]
- Match all elements :
-
xpath
Description copied from interface:MatchMatch 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$myVarare not supported. You must provide at least one variable in thevariablesargument 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")
- 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
Match.namespace(String, String)prior toMatch.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(.)]
- Match all elements with id greater than 5:
-
first
-
has
Description copied from interface:MatchReduce 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
- CSS selectors cannot be used (yet) to select XML
elements from this method. Use
Match.find(String)instead - XPath cannot be used. Use
Match.xpath(String)instead - Namespaces cannot be used. Use
Match.xpath(String)withMatch.namespaces(Map)instead
-
has
Description copied from interface:MatchReduce the set of matched element to those who have a descendant that matches a filter.The callback
Contextis populated like this:-
Context.match()- the matched element whose descendants are searched -
Context.matchIndex()- the index of the matched element whose descendants are searched -
Context.element()- the descendant candidate that is being filtered -
Context.elementIndex()- the iteration index of the descendant candidate that is being filtered
-
-
is
Description copied from interface:MatchCheck 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
- CSS selectors cannot be used (yet) to select XML
elements from this method. Use
Match.find(String)instead - XPath cannot be used. Use
Match.xpath(String)instead - Namespaces cannot be used. Use
Match.xpath(String)withMatch.namespaces(Map)instead
-
is
Description copied from interface:MatchCheck if at least one element in the set of matched elements satisfies a filter.The callback
Contextis populated like this:-
Context.match()- the matched element being checked -
Context.matchIndex()- the index of the matched element being checked
-
-
last
-
map
-
next
-
next
Description copied from interface:MatchGet the immediate next sibling of every element in set of matched elements, matching a selectorThe 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 cannot be used (yet) to select XML
elements from this method. Use
Match.find(String)instead - XPath cannot be used. Use
Match.xpath(String)instead - Namespaces cannot be used. Use
Match.xpath(String)withMatch.namespaces(Map)instead
-
next
Description copied from interface:MatchGet the immediate next sibling of every element in set of matched elements, matching a filterThe callback
Contextis populated like this:-
Context.match()- the matched element whose next sibling is searched -
Context.matchIndex()- the index of the matched element whose next sibling is searched -
Context.element()- the next sibling that is being filtered -
Context.elementIndex()- 1
-
-
nextAll
-
nextAll
Description copied from interface:MatchGet all next siblings of every element in a set of matched elements, matching a selectorThe 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 cannot be used (yet) to select XML
elements from this method. Use
Match.find(String)instead - XPath cannot be used. Use
Match.xpath(String)instead - Namespaces cannot be used. Use
Match.xpath(String)withMatch.namespaces(Map)instead
-
nextAll
Description copied from interface:MatchGet all next siblings of every element in a set of matched elements, matching a filterThe callback
Contextis populated like this:-
Context.match()- the matched element whose next siblings are searched -
Context.matchIndex()- the index of the matched element whose next siblings are searched -
Context.element()- the next siblings that is being filtered -
Context.elementIndex()- the relative index of the next siblings that are being filtered
-
-
nextUntil
Description copied from interface:MatchGet all next siblings of every element in a set of matched elements until the provided selector matchesThe 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 cannot be used (yet) to select XML
elements from this method. Use
Match.find(String)instead - XPath cannot be used. Use
Match.xpath(String)instead - Namespaces cannot be used. Use
Match.xpath(String)withMatch.namespaces(Map)instead
-
nextUntil
Description copied from interface:MatchGet all next siblings of every element in a set of matched elements until the provided filter matchesThe callback
Contextis populated like this:-
Context.match()- the matched element whose next siblings are searched -
Context.matchIndex()- the index of the matched element whose next siblings are searched -
Context.element()- the next siblings that is being filtered -
Context.elementIndex()- the relative index of the next siblings that are being filtered
-
-
nextUntil
Description copied from interface:MatchGet all next siblings of every element in a set of matched elements, matching a selector, until the provided selector matchesThe 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 cannot be used (yet) to select XML
elements from this method. Use
Match.find(String)instead - XPath cannot be used. Use
Match.xpath(String)instead - Namespaces cannot be used. Use
Match.xpath(String)withMatch.namespaces(Map)instead
-
nextUntil
Description copied from interface:MatchGet all next siblings of every element in a set of matched elements, matching a filter, until the provided selector matchesThe callback
Contextis populated like this:-
Context.match()- the matched element whose next siblings are searched -
Context.matchIndex()- the index of the matched element whose next siblings are searched -
Context.element()- the next siblings that is being filtered -
Context.elementIndex()- the relative index of the next siblings that are being filtered
-
-
nextUntil
Description copied from interface:MatchGet all next siblings of every element in a set of matched elements, matching a selector until the provided filter matchesThe callback
Contextis populated like this:-
Context.match()- the matched element whose next siblings are searched -
Context.matchIndex()- the index of the matched element whose next siblings are searched -
Context.element()- the next siblings that is being filtered -
Context.elementIndex()- the relative index of the next siblings that are being filtered
-
-
nextUntil
Description copied from interface:MatchGet all next siblings of every element in a set of matched elements, matching a filter until the provided filter matchesThe callback
Contextis populated like this:-
Context.match()- the matched element whose next siblings are searched -
Context.matchIndex()- the index of the matched element whose next siblings are searched -
Context.element()- the next siblings that is being filtered -
Context.elementIndex()- the relative index of the next siblings that are being filtered
-
-
next
-
not
Description copied from interface:MatchRemove 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
- CSS selectors cannot be used (yet) to select XML
elements from this method. Use
Match.find(String)instead - XPath cannot be used. Use
Match.xpath(String)instead - Namespaces cannot be used. Use
Match.xpath(String)withMatch.namespaces(Map)instead
-
not
Description copied from interface:MatchRemove elements from the set of matched elements.The callback
Contextis populated like this:-
Context.match()- the matched element being checked -
Context.matchIndex()- the index of the matched element being checked
-
-
parent
-
parent
Description copied from interface:MatchGet the immediate parent elements of every element in a set of matched elements, matching a selectorThe 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 cannot be used (yet) to select XML
elements from this method. Use
Match.find(String)instead - XPath cannot be used. Use
Match.xpath(String)instead - Namespaces cannot be used. Use
Match.xpath(String)withMatch.namespaces(Map)instead
-
parent
Description copied from interface:MatchGet the immediate parent elements of every element in a set of matched elements, matching a filterThe callback
Contextis populated like this:-
Context.match()- the matched element whose parent is searched -
Context.matchIndex()- the index of the matched element whose parent is searched -
Context.element()- the parent that is being filtered -
Context.elementIndex()- 1
-
-
parents
-
parents
Description copied from interface:MatchGet all ancestor elements of every element in a set of matched elements, matching a selectorThe 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 cannot be used (yet) to select XML
elements from this method. Use
Match.find(String)instead - XPath cannot be used. Use
Match.xpath(String)instead - Namespaces cannot be used. Use
Match.xpath(String)withMatch.namespaces(Map)instead
-
parents
Description copied from interface:MatchGet all ancestor elements of every element in a set of matched elements, matching a filterThe callback
Contextis populated like this:-
Context.match()- the matched element whose parents are searched -
Context.matchIndex()- the index of the matched element whose parents are searched -
Context.element()- the parent that is being filtered -
Context.elementIndex()- the relative index of the parent that is being filtered
-
-
parentsUntil
Description copied from interface:MatchGet all ancestors of every element in a set of matched elements until the provided selector matchesThe 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 cannot be used (yet) to select XML
elements from this method. Use
Match.find(String)instead - XPath cannot be used. Use
Match.xpath(String)instead - Namespaces cannot be used. Use
Match.xpath(String)withMatch.namespaces(Map)instead
- Specified by:
parentsUntilin interfaceMatch- See Also:
-
parentsUntil
Description copied from interface:MatchGet all ancestors of every element in a set of matched elements until the provided filter matchesThe callback
Contextis populated like this:-
Context.match()- the matched element whose parents are searched -
Context.matchIndex()- the index of the matched element whose parents are searched -
Context.element()- the parent that is being filtered -
Context.elementIndex()- the relative index of the parent that is being filtered
- Specified by:
parentsUntilin interfaceMatch
-
-
parentsUntil
Description copied from interface:MatchGet all ancestors of every element in a set of matched elements, matching a selector, until the provided selector matchesThe 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 cannot be used (yet) to select XML
elements from this method. Use
Match.find(String)instead - XPath cannot be used. Use
Match.xpath(String)instead - Namespaces cannot be used. Use
Match.xpath(String)withMatch.namespaces(Map)instead
- Specified by:
parentsUntilin interfaceMatch- See Also:
-
parentsUntil
Description copied from interface:MatchGet all ancestors of every element in a set of matched elements, matching a filter, until the provided selector matchesThe callback
Contextis populated like this:-
Context.match()- the matched element whose parents are searched -
Context.matchIndex()- the index of the matched element whose parents are searched -
Context.element()- the parent that is being filtered -
Context.elementIndex()- the relative index of the parent that is being filtered
- Specified by:
parentsUntilin interfaceMatch- See Also:
-
-
parentsUntil
Description copied from interface:MatchGet all ancestors of every element in a set of matched elements, matching a selector until the provided filter matchesThe callback
Contextis populated like this:-
Context.match()- the matched element whose parents are searched -
Context.matchIndex()- the index of the matched element whose parents are searched -
Context.element()- the parent that is being filtered -
Context.elementIndex()- the relative index of the parent that is being filtered
- Specified by:
parentsUntilin interfaceMatch- See Also:
-
-
parentsUntil
Description copied from interface:MatchGet all ancestors of every element in a set of matched elements, matching a filter until the provided filter matchesThe callback
Contextis populated like this:-
Context.match()- the matched element whose parents are searched -
Context.matchIndex()- the index of the matched element whose parents are searched -
Context.element()- the parent that is being filtered -
Context.elementIndex()- the relative index of the parent that is being filtered
- Specified by:
parentsUntilin interfaceMatch
-
-
parents
-
prev
-
prev
Description copied from interface:MatchGet the immediate previous sibling of every element in set of matched elements, matching a selectorThe 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 cannot be used (yet) to select XML
elements from this method. Use
Match.find(String)instead - XPath cannot be used. Use
Match.xpath(String)instead - Namespaces cannot be used. Use
Match.xpath(String)withMatch.namespaces(Map)instead
-
prev
Description copied from interface:MatchGet the immediate previous sibling of every element in set of matched elements, matching a filterThe callback
Contextis populated like this:-
Context.match()- the matched element whose previous sibling is searched -
Context.matchIndex()- the index of the matched element whose previous sibling is searched -
Context.element()- the previous sibling that is being filtered -
Context.elementIndex()- 1
-
-
prevAll
-
prevAll
Description copied from interface:MatchGet all previous siblings of every element in a set of matched elements, matching a selectorThe 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 cannot be used (yet) to select XML
elements from this method. Use
Match.find(String)instead - XPath cannot be used. Use
Match.xpath(String)instead - Namespaces cannot be used. Use
Match.xpath(String)withMatch.namespaces(Map)instead
-
prevAll
Description copied from interface:MatchGet all previous siblings of every element in a set of matched elements, matching a filterThe callback
Contextis populated like this:-
Context.match()- the matched element whose previous siblings are searched -
Context.matchIndex()- the index of the matched element whose previous siblings are searched -
Context.element()- the previous siblings that is being filtered -
Context.elementIndex()- the relative index of the previous siblings that are being filtered
-
-
prevUntil
Description copied from interface:MatchGet all previous siblings of every element in a set of matched elements until the provided selector matchesThe 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 cannot be used (yet) to select XML
elements from this method. Use
Match.find(String)instead - XPath cannot be used. Use
Match.xpath(String)instead - Namespaces cannot be used. Use
Match.xpath(String)withMatch.namespaces(Map)instead
-
prevUntil
Description copied from interface:MatchGet all previous siblings of every element in a set of matched elements until the provided filter matchesThe callback
Contextis populated like this:-
Context.match()- the matched element whose previous siblings are searched -
Context.matchIndex()- the index of the matched element whose previous siblings are searched -
Context.element()- the previous siblings that is being filtered -
Context.elementIndex()- the relative index of the previous siblings that are being filtered
-
-
prevUntil
Description copied from interface:MatchGet all previous siblings of every element in a set of matched elements, matching a selector, until the provided selector matchesThe 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 cannot be used (yet) to select XML
elements from this method. Use
Match.find(String)instead - XPath cannot be used. Use
Match.xpath(String)instead - Namespaces cannot be used. Use
Match.xpath(String)withMatch.namespaces(Map)instead
-
prevUntil
Description copied from interface:MatchGet all previous siblings of every element in a set of matched elements, matching a filter, until the provided selector matchesThe callback
Contextis populated like this:-
Context.match()- the matched element whose previous siblings are searched -
Context.matchIndex()- the index of the matched element whose previous siblings are searched -
Context.element()- the previous siblings that is being filtered -
Context.elementIndex()- the relative index of the previous siblings that are being filtered
-
-
prevUntil
Description copied from interface:MatchGet all previous siblings of every element in a set of matched elements, matching a selector until the provided filter matchesThe callback
Contextis populated like this:-
Context.match()- the matched element whose previous siblings are searched -
Context.matchIndex()- the index of the matched element whose previous siblings are searched -
Context.element()- the previous siblings that is being filtered -
Context.elementIndex()- the relative index of the previous siblings that are being filtered
-
-
prevUntil
Description copied from interface:MatchGet all previous siblings of every element in a set of matched elements, matching a filter until the provided filter matchesThe callback
Contextis populated like this:-
Context.match()- the matched element whose previous siblings are searched -
Context.matchIndex()- the index of the matched element whose previous siblings are searched -
Context.element()- the previous siblings that is being filtered -
Context.elementIndex()- the relative index of the previous siblings that are being filtered
-
-
prev
-
axis
-
siblings
-
siblings
Description copied from interface:MatchGet all siblings of every element in a set of matched elements, matching a selectorThe 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 cannot be used (yet) to select XML
elements from this method. Use
Match.find(String)instead - XPath cannot be used. Use
Match.xpath(String)instead - Namespaces cannot be used. Use
Match.xpath(String)withMatch.namespaces(Map)instead
-
siblings
Description copied from interface:MatchGet all siblings of every element in a set of matched elements, matching a filterThe callback
Contextis populated like this:-
Context.match()- the matched element whose siblings are searched -
Context.matchIndex()- the index of the matched element whose siblings are searched -
Context.element()- the sibling that is being filtered -
Context.elementIndex()- the relative index of the sibling that is being filtered. This is less than zero if it is a previous sibling or more than zero if it is a subsequent sibling, compared to the element inContext.match()
-
-
slice
-
slice
-
matchText
-
matchText
Description copied from interface:MatchReduce 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) -
matchTag
-
matchTag
Description copied from interface:MatchReduce 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) -
matchAttr
Description copied from interface:MatchReduce the set of matched elements by filtering out those whose attribute content doesn't match a given regexThis is the same as calling
matchAttr(name, valueRegex, true) -
matchAttr
Description copied from interface:MatchReduce 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) -
leaf
-
after
-
after
Description copied from interface:MatchAdd content after each element in the set of matched elements.The callback
Contextis populated like this:-
Context.match()- the matched element being appended after -
Context.matchIndex()- the index of the matched element being appended after
-
-
after
Description copied from interface:MatchAdd 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
Description copied from interface:MatchAdd 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.
-
before
-
before
Description copied from interface:MatchAdd content before each element in the set of matched elements.The callback
Contextis populated like this:-
Context.match()- the matched element being prepended before -
Context.matchIndex()- the index of the matched element being prepended before
-
-
before
Description copied from interface:MatchAdd 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
Description copied from interface:MatchAdd 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.
-
append
-
append
Description copied from interface:MatchAppend content to the end of each element's content in the set of matched elements.The callback
Contextis populated like this:-
Context.match()- the matched element being appended to -
Context.matchIndex()- the index of the matched element being appended to
-
-
append
Description copied from interface:MatchAppend 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
Description copied from interface:MatchAppend 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.
-
prepend
-
prepend
Description copied from interface:MatchPrepend content to the beginning of each element's content in the set of matched elements.The callback
Contextis populated like this:-
Context.match()- the matched element being prepended to -
Context.matchIndex()- the index of the matched element being prepended to
-
-
prepend
Description copied from interface:MatchPrepend 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
Description copied from interface:MatchPrepend 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.
-
attr
Description copied from interface:MatchGet an attribute from the first element in the set of matched elements, ornullif 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
Description copied from interface:MatchGet a converted attribute from the first element in the set of matched elements, ornullif 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.
-
attrs
Description copied from interface:MatchGet an attribute from all elements in the set of matched elementsjOOX is namespace-unaware. The supplied attribute name will be compared against all attributes, matching the first one that has the given name.
-
attrs
Description copied from interface:MatchGet a converted attribute from all elements in the set of matched elementsjOOX is namespace-unaware. The supplied attribute name will be compared against all attributes, matching the first one that has the given name.
-
attr
-
attr
Description copied from interface:MatchSet an attribute on all elements in the set of matched elements. Ifvaluereturns null, then the attribute is removed. If the attribute already exists, then it is replaced.The callback
Contextis populated like this:-
Context.match()- the matched element being attributed -
Context.matchIndex()- the index of the matched element being attributed
-
-
removeAttr
Description copied from interface:MatchRemove an attribute from all elements in the set of matched elements. This is the same as callingattr(name, null).- Specified by:
removeAttrin interfaceMatch
-
content
-
content
-
contents
-
contents
-
content
-
content
Description copied from interface:MatchAdd 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 withMatch.text(String) -
content
-
content
Description copied from interface:MatchAdd 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 withMatch.text(String)The callback
Contextis populated like this:-
Context.match()- the matched element being added to -
Context.matchIndex()- the index of the matched element being added to
-
-
text
-
text
-
text
-
texts
-
texts
-
texts
-
text
-
text
Description copied from interface:MatchSet some text content to all elements in the set of matched elements (possibly replacing existing content).The callback
Contextis populated like this:-
Context.match()- the matched element being added to -
Context.matchIndex()- the index of the matched element being added to
-
-
cdata
Description copied from interface:MatchGet the CDATA content of the first element in the set of matched elements, ornullif there are no matched elements.This is the same as calling
cdata(0)orMatch.text(). -
cdata
Description copied from interface:MatchGet the CDATA content at a given index in the current set of matched elements.This is the same as
Match.text(int). -
cdata
Description copied from interface:MatchGet the converted CDATA content of the first element in the set of matched elements, ornullif there are no matched elements.This is the same as
Match.text(Class). -
cdatas
-
cdatas
-
cdatas
-
cdata
Description copied from interface:MatchSet some CDATA content to all elements in the set of matched elements (possibly replacing existing content).Unlike
Match.text(Content), this generates aNode.CDATA_SECTION_NODE. -
cdata
Description copied from interface:MatchSet some CDATA content to all elements in the set of matched elements (possibly replacing existing content).The callback
Contextis populated like this:Context.match()- the matched element being added toContext.matchIndex()- the index of the matched element being added to
Unlike
Match.text(Content), this generates aNode.CDATA_SECTION_NODE. -
empty
-
remove
-
remove
Description copied from interface:MatchRemoves all elements from their parent nodes in the set of matched elements, matching a selectorThe 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 cannot be used (yet) to select XML
elements from this method. Use
Match.find(String)instead - XPath cannot be used. Use
Match.xpath(String)instead - Namespaces cannot be used. Use
Match.xpath(String)withMatch.namespaces(Map)instead
-
remove
Description copied from interface:MatchRemoves all elements from their parent nodes in the set of matched elements, matching a filterThe callback
Contextis populated like this:-
Context.match()- the matched element being removed -
Context.matchIndex()- the index of the matched element being removed
-
-
remove
-
empty
-
wrap
-
wrap
-
unwrap
-
replaceWith
Description copied from interface:MatchReplace all elements in the set of matched elements with some new content.- Specified by:
replaceWithin interfaceMatch
-
replaceWith
Description copied from interface:MatchReplace all elements in the set of matched elements with some new content.- Specified by:
replaceWithin interfaceMatch
-
replaceWith
Description copied from interface:MatchReplace 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.
- Specified by:
replaceWithin interfaceMatch
-
replaceWith
Description copied from interface:MatchReplace 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.
- Specified by:
replaceWithin interfaceMatch
-
rename
-
rename
-
isFast
-
copy
-
xpath
-
xpath
-
xpaths
-
xpaths
-
tag
-
tag
-
tags
-
tags
-
id
-
id
-
id
-
ids
-
ids
-
ids
-
write
Description copied from interface:MatchWrite the set of matched elements into a writerIf the set contains more or less than
1element, this will result in writing non-well-formed XML- Specified by:
writein interfaceMatch- Throws:
IOException
-
write
Description copied from interface:MatchWrite the set of matched elements into a streamIf the set contains more or less than
1element, this will result in writing non-well-formed XML- Specified by:
writein interfaceMatch- Throws:
IOException
-
write
Description copied from interface:MatchWrite the set of matched elements into a fileIf the set contains more or less than
1element, this will result in writing non-well-formed XML- Specified by:
writein interfaceMatch- Throws:
IOException
-
unmarshal
-
unmarshal
-
unmarshalOne
Description copied from interface:MatchUnmarshal the first element in the current set of matched elements into a JAXB-annotated type.This is the same as calling
unmarshalOne(type, 0)- Specified by:
unmarshalOnein interfaceMatch
-
unmarshalOne
Description copied from interface:MatchUnmarshal 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)- Specified by:
unmarshalOnein interfaceMatch
-
transform
Description copied from interface:MatchTransform all elements in the set of matched elements.This will apply a given
Transformerto every element in the set of matched elements. Every element in the set of matched elements will be replaced by its correspondingResultobtained from thetransformer.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
-
transform
Description copied from interface:MatchTransform all elements in the set of matched elements. -
transform
-
transform
-
transform
-
transform
-
sort
-
toString
-
hashCode
-
equals
-