- java.lang.Object
-
- org.joox.Impl
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private classImpl.ChainedContextA namespace context that is aware of this Impl's configured namespaces, as well as a chained context.private static classImpl.VariableResolverA simple variable resolver mapping variable names to their respective index in an XPath expression.
-
Field Summary
Fields Modifier and Type Field Description private org.w3c.dom.Documentdocumentprivate java.util.List<org.w3c.dom.Element>elementsprivate java.util.Map<java.lang.String,java.lang.String>namespacesprivate ImplpreviousMatchstatic java.util.regex.PatternSIMPLE_SELECTORA selector pattern that can be evaluated using standard DOM API
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Impladd(Match... e)Add some elements to the set of matched elementsImpladd(org.w3c.dom.Element... e)Add some elements to the set of matched elements(package private) ImpladdElements(java.util.Collection<org.w3c.dom.Element> e)(package private) ImpladdElements(org.w3c.dom.Element... e)(package private) ImpladdNodeList(org.w3c.dom.NodeList list)(package private) ImpladdNodeLists(java.util.List<org.w3c.dom.NodeList> lists)(package private) ImpladdUniqueElements(java.util.List<org.w3c.dom.Element> e)(package private) ImpladdUniqueElements(org.w3c.dom.Element... e)Implafter(java.lang.String content)Add content after each element in the set of matched elements.Implafter(Content content)Add content after each element in the set of matched elements.Implafter(Match... content)Add content after each element in the set of matched elements.Implafter(org.w3c.dom.Element... content)Add content after each element in the set of matched elements.ImplandSelf()Add the previous set of matched elements to the current one.Implappend(java.lang.String content)Append content to the end of each element's content in the set of matched elements.Implappend(Content content)Append content to the end of each element's content in the set of matched elements.Implappend(Match... content)Append content to the end of each element's content in the set of matched elements.Implappend(org.w3c.dom.Element... content)Append content to the end of each element's content in the set of matched elements.java.lang.Stringattr(java.lang.String name)Get an attribute from the first element in the set of matched elements, ornullif the first element does not have that attribute.<T> Tattr(java.lang.String name, java.lang.Class<T> type)Get a converted attribute from the first element in the set of matched elements, ornullif the first element does not have that attribute.Implattr(java.lang.String name, java.lang.String value)Set an attribute on all elements in the set of matched elements.Implattr(java.lang.String name, Content content)Set an attribute on all elements in the set of matched elements.java.util.List<java.lang.String>attrs(java.lang.String name)Get an attribute from all elements in the set of matched elements<T> java.util.List<T>attrs(java.lang.String name, java.lang.Class<T> type)Get a converted attribute from all elements in the set of matched elementsprivate Implaxis(boolean all, Filter until, Filter filter, java.util.function.Function<org.w3c.dom.Node,org.w3c.dom.Node> iterate, java.util.function.Consumer<java.util.List<org.w3c.dom.Element>> finisher)Implbefore(java.lang.String content)Add content before each element in the set of matched elements.Implbefore(Content content)Add content before each element in the set of matched elements.Implbefore(Match... content)Add content before each element in the set of matched elements.Implbefore(org.w3c.dom.Element... content)Add content before each element in the set of matched elements.java.lang.Stringcdata()Get the CDATA content of the first element in the set of matched elements, ornullif there are no matched elements.java.lang.Stringcdata(int index)Get the CDATA content at a given index in the current set of matched elements.<T> Tcdata(java.lang.Class<T> type)Get the converted CDATA content of the first element in the set of matched elements, ornullif there are no matched elements.Implcdata(java.lang.String content)Set some CDATA content to all elements in the set of matched elements (possibly replacing existing content).Implcdata(Content content)Set some CDATA content to all elements in the set of matched elements (possibly replacing existing content).java.util.List<java.lang.String>cdatas()Get all CDATA content of the elements in the set of matched elements.java.util.List<java.lang.String>cdatas(int... indexes)Get all CDATA content of the elements at given indexes in the set of matched elements.<T> java.util.List<T>cdatas(java.lang.Class<T> type)Get all converted CDATA content of the elements in the set of matched elements.Implchild()Find the first child of each element in the current set of matched elements.Implchild(int index)Find the child at a given index of each element in the current set of matched elements.Implchild(java.lang.String selector)Find the first matching child of each element in the current set of matched elementsImplchild(Filter filter)Find the first matching child of each element in the current set of matched elementsImplchildren()Find all children of each element in the current set of matched elements.Implchildren(int... indexes)Find all children of each element at given indexes in the current set of matched elements.Implchildren(java.lang.String selector)Find all children of each element in the current set of matched elements.Implchildren(Filter filter)Find all children of each element in the current set of matched elements.java.lang.Stringcontent()Get the XML content of the first element in the set of matched elements, ornullif there are no matched elements.java.lang.Stringcontent(int index)Get the XML content at a given index in the current set of matched elements.Implcontent(java.lang.Object content)Add some JAXB-marshallable XML content to all elements in the set of matched elements (possibly replacing existing content).Implcontent(java.lang.String content)Add some XML content to all elements in the set of matched elements (possibly replacing existing content).Implcontent(Content content)Add some XML content to all elements in the set of matched elements (possibly replacing existing content).private java.lang.Stringcontent(org.w3c.dom.Element element)java.util.List<java.lang.String>contents()Get all XML content of the elements in the set of matched elements.java.util.List<java.lang.String>contents(int... indexes)Get all XML content of the elements at given indexes in the set of matched elements.Implcopy()Get a copy of theMatchwrapper.org.w3c.dom.Documentdocument()Get the underlying document of the set of matched elements.java.util.List<Match>each()Get all elements in the set of matched elements in a list of matches, every match representing one elementImpleach(java.lang.Iterable<? extends Each> each)Execute several callbacks for every element in the current set of matched elements.Impleach(Each each)Execute a callback for every element in the current set of matched elements.Impleach(Each... each)Execute several callbacks for every element in the current set of matched elements.Matchempty()Removes all content from all elements in the set of matched elements.private voidempty(org.w3c.dom.Element element)Impleq(int... indexes)Reduce the current set of matched elements to the elements at the given indexes.booleanequals(java.lang.Object obj)Implfilter(java.lang.String selector)Reduce the current set of matched elements.Implfilter(Filter filter)Reduce the current set of matched elements.private java.util.List<org.w3c.dom.Element>filter0(Filter filter)Implfind()Find all descendants of each element in the current set of matched elements.Implfind(java.lang.String selector)Find all descendants of each element in the current set of matched elements.Implfind(Filter filter)Find all descendants of each element in the current set of matched elements.Implfirst()Get the first in a set of matched elements.java.util.List<org.w3c.dom.Element>get()Get an the set of matched elementsorg.w3c.dom.Elementget(int index)Get an element from the set of matched elements at a given indexjava.util.List<org.w3c.dom.Element>get(int... indexes)Get some elements from the set of matched elements at the given indexesImplhas(java.lang.String selector)Reduce the set of matched element to those who have a descendant that matches a selector.Implhas(Filter filter)Reduce the set of matched element to those who have a descendant that matches a filter.inthashCode()java.lang.Stringid()Get the first id valuejava.lang.Stringid(int index)Get an id value at a given index in the current set of matched elements.<T> Tid(java.lang.Class<T> type)Get the first converted id valuejava.util.List<java.lang.String>ids()Get a list of id values in the current set of matched elements.java.util.List<java.lang.String>ids(int... indexes)Get a list of id values at given indexes in the current set of matched elements.<T> java.util.List<T>ids(java.lang.Class<T> type)Get a list of converted id values in the current set of matched elements.booleanis(java.lang.String selector)Check if at least one element in the set of matched elements satisfies a selector.booleanis(Filter filter)Check if at least one element in the set of matched elements satisfies a filter.booleanisEmpty()Whether there are any matched elements in the set of matched elementsprivate booleanisFast(Filter filter)booleanisNotEmpty()Whether 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 elementsjava.util.Iterator<org.w3c.dom.Element>iterator()Impllast()Get the last in a set of matched elements.Implleaf()Reduce the set of matched elements to the ones that are leaf elements<E> java.util.List<E>map(Mapper<E> map)Map the set of matched elements to a list of somethingMatchmatchAttr(java.lang.String name, java.lang.String valueRegex)Reduce the set of matched elements by filtering out those whose attribute content doesn't match a given regexMatchmatchAttr(java.lang.String name, java.lang.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)ImplmatchTag(java.lang.String regex)Reduce the set of matched elements by filtering out those whose tag name doesn't match a given regexImplmatchTag(java.lang.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)ImplmatchText(java.lang.String regex)Reduce the set of matched elements by filtering out those whose text content doesn't match a given regexImplmatchText(java.lang.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)Matchnamespace(java.lang.String namespacePrefix, java.lang.String namespaceURI)Get a new Match with added namespace configuration for subsequent XPath callsjava.lang.StringnamespacePrefix()Get the namespace prefix of the first element in the current set of matched elements.java.lang.StringnamespacePrefix(int index)Get a namespace prefix of the element at a given index in the current set of matched elements.java.util.List<java.lang.String>namespacePrefixes()Get a list of namespace prefixes of the elements in the current set of matched elements.java.util.List<java.lang.String>namespacePrefixes(int... indexes)Get a list of namespace prefixes of the elements at given indexes in the current set of matched elements.Matchnamespaces(java.util.Map<java.lang.String,java.lang.String> map)Get a new Match with added namespace configuration for subsequent XPath callsjava.lang.StringnamespaceURI()Get the namespace URI of the first element in the current set of matched elements.java.lang.StringnamespaceURI(int index)Get a namespace URI of the element at a given index in the current set of matched elements.java.util.List<java.lang.String>namespaceURIs()Get a list of namespace URIs of the elements in the current set of matched elements.java.util.List<java.lang.String>namespaceURIs(int... indexes)Get a list of namespace URIs of the elements at given indexes in the current set of matched elements.Implnext()Get the immediate next sibling of every element in set of matched elements.private Implnext(boolean all, Filter until, Filter filter)Implnext(java.lang.String selector)Get the immediate next sibling of every element in set of matched elements, matching a selectorImplnext(Filter filter)Get the immediate next sibling of every element in set of matched elements, matching a filterImplnextAll()Get all next siblings of every element in a set of matched elementsImplnextAll(java.lang.String selector)Get all next siblings of every element in a set of matched elements, matching a selectorImplnextAll(Filter filter)Get all next siblings of every element in a set of matched elements, matching a filterImplnextUntil(java.lang.String until)Get all next siblings of every element in a set of matched elements until the provided selector matchesImplnextUntil(java.lang.String until, java.lang.String selector)Get all next siblings of every element in a set of matched elements, matching a selector, until the provided selector matchesImplnextUntil(java.lang.String until, Filter filter)Get all next siblings of every element in a set of matched elements, matching a filter, until the provided selector matchesImplnextUntil(Filter until)Get all next siblings of every element in a set of matched elements until the provided filter matchesImplnextUntil(Filter until, java.lang.String selector)Get all next siblings of every element in a set of matched elements, matching a selector until the provided filter matchesImplnextUntil(Filter until, Filter filter)Get all next siblings of every element in a set of matched elements, matching a filter until the provided filter matchesImplnot(java.lang.String selector)Remove elements from the set of matched elements.Implnot(Filter filter)Remove elements from the set of matched elements.Implparent()Get the immediate parent elements of every element in a set of matched elementsImplparent(java.lang.String selector)Get the immediate parent elements of every element in a set of matched elements, matching a selectorImplparent(Filter filter)Get the immediate parent elements of every element in a set of matched elements, matching a filterImplparents()Get all ancestor elements of every element in a set of matched elementsprivate Implparents(boolean all, Filter until, Filter filter)Implparents(java.lang.String selector)Get all ancestor elements of every element in a set of matched elements, matching a selectorImplparents(Filter filter)Get all ancestor elements of every element in a set of matched elements, matching a filterImplparentsUntil(java.lang.String until)Get all ancestors of every element in a set of matched elements until the provided selector matchesImplparentsUntil(java.lang.String until, java.lang.String selector)Get all ancestors of every element in a set of matched elements, matching a selector, until the provided selector matchesImplparentsUntil(java.lang.String until, Filter filter)Get all ancestors of every element in a set of matched elements, matching a filter, until the provided selector matchesImplparentsUntil(Filter until)Get all ancestors of every element in a set of matched elements until the provided filter matchesImplparentsUntil(Filter until, java.lang.String selector)Get all ancestors of every element in a set of matched elements, matching a selector until the provided filter matchesImplparentsUntil(Filter until, Filter filter)Get all ancestors of every element in a set of matched elements, matching a filter until the provided filter matchesImplprepend(java.lang.String content)Prepend content to the beginning of each element's content in the set of matched elements.Implprepend(Content content)Prepend content to the beginning of each element's content in the set of matched elements.Implprepend(Match... content)Prepend content to the beginning of each element's content in the set of matched elements.Implprepend(org.w3c.dom.Element... content)Prepend content to the beginning of each element's content in the set of matched elements.Implprev()Get the immediate previous sibling of every element in set of matched elements.private Implprev(boolean all, Filter until, Filter filter)Implprev(java.lang.String selector)Get the immediate previous sibling of every element in set of matched elements, matching a selectorImplprev(Filter filter)Get the immediate previous sibling of every element in set of matched elements, matching a filterImplprevAll()Get all previous siblings of every element in a set of matched elementsImplprevAll(java.lang.String selector)Get all previous siblings of every element in a set of matched elements, matching a selectorImplprevAll(Filter filter)Get all previous siblings of every element in a set of matched elements, matching a filterImplprevUntil(java.lang.String until)Get all previous siblings of every element in a set of matched elements until the provided selector matchesImplprevUntil(java.lang.String until, java.lang.String selector)Get all previous siblings of every element in a set of matched elements, matching a selector, until the provided selector matchesImplprevUntil(java.lang.String until, Filter filter)Get all previous siblings of every element in a set of matched elements, matching a filter, until the provided selector matchesImplprevUntil(Filter until)Get all previous siblings of every element in a set of matched elements until the provided filter matchesImplprevUntil(Filter until, java.lang.String selector)Get all previous siblings of every element in a set of matched elements, matching a selector until the provided filter matchesImplprevUntil(Filter until, Filter filter)Get all previous siblings of every element in a set of matched elements, matching a filter until the provided filter matchesImplremove()Removes all elements from their parent nodes in the set of matched elements.Implremove(java.lang.String selector)Removes all elements from their parent nodes in the set of matched elements, matching a selectorImplremove(Filter filter)Removes all elements from their parent nodes in the set of matched elements, matching a filterprivate voidremove(org.w3c.dom.Element element)ImplremoveAttr(java.lang.String name)Remove an attribute from all elements in the set of matched elements.Matchrename(java.lang.String tag)Rename all tags in the set of matched elements to some new tag nameMatchrename(Content tag)Rename all tags in the set of matched elements to some new tag nameImplreplaceWith(java.lang.String content)Replace all elements in the set of matched elements with some new content.ImplreplaceWith(Content content)Replace all elements in the set of matched elements with some new content.ImplreplaceWith(Match... content)Replace all elements in the set of matched elements with some new content.ImplreplaceWith(org.w3c.dom.Element... content)Replace all elements in the set of matched elements with some new content.Implreverse()Reverse the order of the set of matched elementsImplsiblings()Get all siblings of every element in a set of matched elementsImplsiblings(java.lang.String selector)Get all siblings of every element in a set of matched elements, matching a selectorImplsiblings(Filter filter)Get all siblings of every element in a set of matched elements, matching a filterintsize()Get the number of matched elements in the set of matched elementsImplslice(int start)Reduce the set of matched elements by specifying a range of indexesImplslice(int start, int end)Reduce the set of matched elements by specifying a range of indexesMatchsort(java.util.Comparator<org.w3c.dom.Element> comparator)Allows to sort the result with the given comparator.java.lang.Stringtag()Get the tag name of the first element in the current set of matched elements.java.lang.Stringtag(int index)Get a tag name of the element at a given index in the current set of matched elements.java.util.List<java.lang.String>tags()Get a list of tag names of the elements in the current set of matched elements.java.util.List<java.lang.String>tags(int... indexes)Get a list of tag names of the elements at given indexes in the current set of matched elements.java.lang.Stringtext()Get the text content of the first element in the set of matched elements, ornullif there are no matched elements.java.lang.Stringtext(int index)Get the text content at a given index in the current set of matched elements.<T> Ttext(java.lang.Class<T> type)Get the converted text content of the first element in the set of matched elements, ornullif there are no matched elements.Impltext(java.lang.String content)Set some text content to all elements in the set of matched elements (possibly replacing existing content).Impltext(Content content)Set some text content to all elements in the set of matched elements (possibly replacing existing content).java.util.List<java.lang.String>texts()Get all text content of the elements in the set of matched elements.java.util.List<java.lang.String>texts(int... indexes)Get all text content of the elements at given indexes in the set of matched elements.<T> java.util.List<T>texts(java.lang.Class<T> type)Get all converted text content of the elements in the set of matched elements.java.lang.StringtoString()Impltransform(java.io.File transformer)Transform all elements in the set of matched elements.Impltransform(java.io.InputStream transformer)Transform all elements in the set of matched elements.Impltransform(java.io.Reader transformer)Transform all elements in the set of matched elements.Impltransform(java.lang.String transformer)Transform all elements in the set of matched elements.Impltransform(java.net.URL transformer)Transform all elements in the set of matched elements.Impltransform(javax.xml.transform.Source transformer)Transform all elements in the set of matched elements.Impltransform(javax.xml.transform.Transformer transformer)Transform all elements in the set of matched elements.<T> java.util.List<T>unmarshal(java.lang.Class<T> type)Unmarshal the current set of matched elements into a JAXB-annotated type.<T> java.util.List<T>unmarshal(java.lang.Class<T> type, int... indexes)Unmarshal the current set of matched elements at given indexes into a JAXB-annotated type.<T> TunmarshalOne(java.lang.Class<T> type)Unmarshal the first element in the current set of matched elements into a JAXB-annotated type.<T> TunmarshalOne(java.lang.Class<T> type, int index)Unmarshal the element at a given index in the current set of matched elements into a JAXB-annotated type.Implunwrap()Removes all elements in the set of matched elements from their parentsImplwrap(java.lang.String content)Wrap all elements from their parent nodes in the set of matched elements in a new parent elementImplwrap(Content content)Wrap all elements in the set of matched elements in a new parent elementMatchwrite(java.io.File file)Write the set of matched elements into a fileMatchwrite(java.io.OutputStream stream)Write the set of matched elements into a streamMatchwrite(java.io.Writer writer)Write the set of matched elements into a writerjava.lang.Stringxpath()Get an XPath expression describing the first element in the current set of matched elementsjava.lang.Stringxpath(int index)Get an XPath expression describing the element at a given index in the current set of matched elementsImplxpath(java.lang.String expression)Match all elements given a certain XPath expression applied to each element in the current set of matched elements.Implxpath(java.lang.String expression, java.lang.Object... variables)Match all elements given a certain XPath expression applied to each element in the current set of matched elements.java.util.List<java.lang.String>xpaths()Get a list of XPath expressions describing the elements in the current set of matched elementsjava.util.List<java.lang.String>xpaths(int... indexes)Get a list of XPath expressions describing the elements at the given indexes in the current set of matched elements
-
-
-
Field Detail
-
document
private final org.w3c.dom.Document document
-
elements
private final java.util.List<org.w3c.dom.Element> elements
-
previousMatch
private final Impl previousMatch
-
namespaces
private final java.util.Map<java.lang.String,java.lang.String> namespaces
-
SIMPLE_SELECTOR
public static final java.util.regex.Pattern SIMPLE_SELECTOR
A selector pattern that can be evaluated using standard DOM API
-
-
Constructor Detail
-
Impl
Impl(org.w3c.dom.Document document, java.util.Map<java.lang.String,java.lang.String> namespaces)
-
Impl
Impl(org.w3c.dom.Document document, java.util.Map<java.lang.String,java.lang.String> namespaces, Impl previousMatch)
-
-
Method Detail
-
addNodeLists
final Impl addNodeLists(java.util.List<org.w3c.dom.NodeList> lists)
-
addNodeList
final Impl addNodeList(org.w3c.dom.NodeList list)
-
addUniqueElements
final Impl addUniqueElements(org.w3c.dom.Element... e)
-
addUniqueElements
final Impl addUniqueElements(java.util.List<org.w3c.dom.Element> e)
-
addElements
final Impl addElements(org.w3c.dom.Element... e)
-
addElements
final Impl addElements(java.util.Collection<org.w3c.dom.Element> e)
-
iterator
public final java.util.Iterator<org.w3c.dom.Element> iterator()
- Specified by:
iteratorin interfacejava.lang.Iterable<org.w3c.dom.Element>
-
namespace
public final Match namespace(java.lang.String namespacePrefix, java.lang.String namespaceURI)
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)- Specified by:
namespacein interfaceMatch- Parameters:
namespacePrefix- A namespace prefixnamespaceURI- A namespace URI- Returns:
- A modified
Match - See Also:
Match.namespaces(Map)
-
namespaces
public final Match namespaces(java.util.Map<java.lang.String,java.lang.String> map)
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
public final java.lang.String 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:
Node.getNamespaceURI()
-
namespaceURI
public final java.lang.String namespaceURI(int index)
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:
Node.getNamespaceURI()
-
namespaceURIs
public final java.util.List<java.lang.String> 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:
Node.getNamespaceURI()
-
namespaceURIs
public final java.util.List<java.lang.String> namespaceURIs(int... indexes)
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:
Node.getNamespaceURI()
-
namespacePrefix
public final java.lang.String 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
public final java.lang.String namespacePrefix(int index)
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
public final java.util.List<java.lang.String> 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
public final java.util.List<java.lang.String> namespacePrefixes(int... indexes)
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
public final org.w3c.dom.Document 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
public final org.w3c.dom.Element get(int index)
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
public final java.util.List<org.w3c.dom.Element> get(int... indexes)
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
public final java.util.List<org.w3c.dom.Element> get()
Description copied from interface:MatchGet an the set of matched elements
-
size
public final int size()
Description copied from interface:MatchGet the number of matched elements in the set of matched elements
-
isEmpty
public final boolean isEmpty()
Description copied from interface:MatchWhether there are any matched elements in the set of matched elements
-
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
public final Impl add(org.w3c.dom.Element... e)
Description copied from interface:MatchAdd some elements to the set of matched elements
-
add
public final Impl add(Match... e)
Description copied from interface:MatchAdd some elements to the set of matched elements
-
reverse
public final Impl reverse()
Description copied from interface:MatchReverse the order of the set of matched elements
-
andSelf
public final Impl 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
public final Impl child()
Description copied from interface:MatchFind the first child of each element in the current set of matched elements.This is the same as calling
child(0).
-
child
public final Impl child(java.lang.String selector)
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
- Specified by:
childin interfaceMatch- See Also:
JOOX.selector(String)
-
child
public final Impl child(Filter filter)
Description copied from interface:MatchFind the first matching child of each element in the current set of matched elements
-
child
public final Impl child(int index)
Description copied from interface:MatchFind the child at a given index of each element in the current set of matched elements.
-
children
public final Impl children()
Description copied from interface:MatchFind all children of each element in the current set of matched elements.
-
children
public final Impl children(int... indexes)
Description copied from interface:MatchFind all children of each element at given indexes in the current set of matched elements.
-
children
public final Impl children(java.lang.String selector)
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
- Specified by:
childrenin interfaceMatch- See Also:
JOOX.selector(String)
-
children
public final Impl children(Filter filter)
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
public final java.util.List<Match> each()
Description copied from interface:MatchGet all elements in the set of matched elements in a list of matches, every match representing one element
-
each
public final Impl each(Each each)
Description copied from interface:MatchExecute a callback for every element in the current set of matched elements.
-
each
public final Impl each(Each... each)
Description copied from interface:MatchExecute several callbacks for every element in the current set of matched elements.- Specified by:
eachin interfaceMatch- See Also:
JOOX.chain(Each...)
-
each
public final Impl each(java.lang.Iterable<? extends Each> each)
Description copied from interface:MatchExecute several callbacks for every element in the current set of matched elements.- Specified by:
eachin interfaceMatch- See Also:
JOOX.chain(Iterable)
-
filter
public final Impl filter(java.lang.String selector)
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
- Specified by:
filterin interfaceMatch- See Also:
JOOX.selector(String)
-
filter
public final Impl filter(Filter 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
private final java.util.List<org.w3c.dom.Element> filter0(Filter filter)
-
eq
public final Impl eq(int... indexes)
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
public final Impl find()
Description copied from interface:MatchFind all descendants of each element in the current set of matched elements.
-
find
public final Impl find(java.lang.String selector)
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
- Specified by:
findin interfaceMatch- See Also:
JOOX.selector(String)
-
isRoot
private boolean isRoot()
Temporary utility method to indicate whether the root element is among the matched elements
-
find
public final Impl find(Filter filter)
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
public final Impl xpath(java.lang.String expression)
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
public final Impl xpath(java.lang.String expression, java.lang.Object... variables)
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
public final Impl first()
Description copied from interface:MatchGet the first in a set of matched elements.
-
has
public final Impl has(java.lang.String selector)
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
- Specified by:
hasin interfaceMatch- See Also:
JOOX.selector(String)
-
has
public final Impl has(Filter filter)
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
public final boolean is(java.lang.String selector)
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
- Specified by:
isin interfaceMatch- See Also:
JOOX.selector(String)
-
is
public final boolean is(Filter filter)
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
public final Impl last()
Description copied from interface:MatchGet the last in a set of matched elements.
-
map
public final <E> java.util.List<E> map(Mapper<E> map)
Description copied from interface:MatchMap the set of matched elements to a list of something
-
next
public final Impl next()
Description copied from interface:MatchGet the immediate next sibling of every element in set of matched elements.
-
next
public final Impl next(java.lang.String selector)
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
- Specified by:
nextin interfaceMatch- See Also:
JOOX.selector(String)
-
next
public final Impl next(Filter filter)
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
public final Impl nextAll()
Description copied from interface:MatchGet all next siblings of every element in a set of matched elements
-
nextAll
public final Impl nextAll(java.lang.String selector)
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
- Specified by:
nextAllin interfaceMatch- See Also:
JOOX.selector(String)
-
nextAll
public final Impl nextAll(Filter filter)
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
public final Impl nextUntil(java.lang.String until)
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
- Specified by:
nextUntilin interfaceMatch- See Also:
JOOX.selector(String)
-
nextUntil
public final Impl nextUntil(Filter until)
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
public final Impl nextUntil(java.lang.String until, java.lang.String selector)
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
- Specified by:
nextUntilin interfaceMatch- See Also:
JOOX.selector(String)
-
nextUntil
public final Impl nextUntil(java.lang.String until, Filter filter)
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
- Specified by:
nextUntilin interfaceMatch- See Also:
JOOX.selector(String)
-
-
nextUntil
public final Impl nextUntil(Filter until, java.lang.String selector)
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
- Specified by:
nextUntilin interfaceMatch- See Also:
JOOX.selector(String)
-
-
nextUntil
public final Impl nextUntil(Filter until, Filter filter)
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
- Specified by:
nextUntilin interfaceMatch- See Also:
JOOX.selector(String)
-
-
not
public final Impl not(java.lang.String selector)
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
- Specified by:
notin interfaceMatch- See Also:
JOOX.selector(String)
-
not
public final Impl not(Filter filter)
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
public final Impl parent()
Description copied from interface:MatchGet the immediate parent elements of every element in a set of matched elements
-
parent
public final Impl parent(java.lang.String selector)
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
- Specified by:
parentin interfaceMatch- See Also:
JOOX.selector(String)
-
parent
public final Impl parent(Filter filter)
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
public final Impl parents()
Description copied from interface:MatchGet all ancestor elements of every element in a set of matched elements
-
parents
public final Impl parents(java.lang.String selector)
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
- Specified by:
parentsin interfaceMatch- See Also:
JOOX.selector(String)
-
parents
public final Impl parents(Filter filter)
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
public final Impl parentsUntil(java.lang.String until)
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:
JOOX.selector(String)
-
parentsUntil
public final Impl parentsUntil(Filter until)
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
public final Impl parentsUntil(java.lang.String until, java.lang.String selector)
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:
JOOX.selector(String)
-
parentsUntil
public final Impl parentsUntil(java.lang.String until, Filter filter)
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:
JOOX.selector(String)
-
-
parentsUntil
public final Impl parentsUntil(Filter until, java.lang.String selector)
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:
JOOX.selector(String)
-
-
parentsUntil
public final Impl parentsUntil(Filter until, Filter filter)
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
-
-
prev
public final Impl prev()
Description copied from interface:MatchGet the immediate previous sibling of every element in set of matched elements.
-
prev
public final Impl prev(java.lang.String selector)
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
- Specified by:
previn interfaceMatch- See Also:
JOOX.selector(String)
-
prev
public final Impl prev(Filter filter)
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
public final Impl prevAll()
Description copied from interface:MatchGet all previous siblings of every element in a set of matched elements
-
prevAll
public final Impl prevAll(java.lang.String selector)
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
- Specified by:
prevAllin interfaceMatch- See Also:
JOOX.selector(String)
-
prevAll
public final Impl prevAll(Filter filter)
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
public final Impl prevUntil(java.lang.String until)
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
- Specified by:
prevUntilin interfaceMatch- See Also:
JOOX.selector(String)
-
prevUntil
public final Impl prevUntil(Filter until)
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
public final Impl prevUntil(java.lang.String until, java.lang.String selector)
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
- Specified by:
prevUntilin interfaceMatch- See Also:
JOOX.selector(String)
-
prevUntil
public final Impl prevUntil(java.lang.String until, Filter filter)
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
- Specified by:
prevUntilin interfaceMatch- See Also:
JOOX.selector(String)
-
-
prevUntil
public final Impl prevUntil(Filter until, java.lang.String selector)
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
- Specified by:
prevUntilin interfaceMatch- See Also:
JOOX.selector(String)
-
-
prevUntil
public final Impl prevUntil(Filter until, Filter filter)
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
-
-
axis
private final Impl axis(boolean all, Filter until, Filter filter, java.util.function.Function<org.w3c.dom.Node,org.w3c.dom.Node> iterate, java.util.function.Consumer<java.util.List<org.w3c.dom.Element>> finisher)
-
siblings
public final Impl siblings()
Description copied from interface:MatchGet all siblings of every element in a set of matched elements
-
siblings
public final Impl siblings(java.lang.String selector)
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
- Specified by:
siblingsin interfaceMatch- See Also:
JOOX.selector(String)
-
siblings
public final Impl siblings(Filter filter)
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
public final Impl slice(int start)
Description copied from interface:MatchReduce the set of matched elements by specifying a range of indexesThis is the same as calling
slice(start, Integer.MAX_VALUE)
-
slice
public final Impl slice(int start, int end)
Description copied from interface:MatchReduce the set of matched elements by specifying a range of indexes
-
matchText
public final Impl matchText(java.lang.String regex)
Description copied from interface:MatchReduce the set of matched elements by filtering out those whose text content doesn't match a given regexThis is the same as calling
matchText(regex, true)- Specified by:
matchTextin interfaceMatch- See Also:
JOOX.matchText(String)
-
matchText
public final Impl matchText(java.lang.String regex, boolean keepMatches)
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)- Specified by:
matchTextin interfaceMatch- See Also:
JOOX.matchText(String)
-
matchTag
public final Impl matchTag(java.lang.String regex)
Description copied from interface:MatchReduce the set of matched elements by filtering out those whose tag name doesn't match a given regexThis is the same as calling
matchText(regex, true)- Specified by:
matchTagin interfaceMatch- See Also:
JOOX.matchTag(String)
-
matchTag
public final Impl matchTag(java.lang.String regex, boolean keepMatches)
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)- Specified by:
matchTagin interfaceMatch- See Also:
JOOX.matchTag(String)
-
matchAttr
public final Match matchAttr(java.lang.String name, java.lang.String valueRegex)
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)- Specified by:
matchAttrin interfaceMatch- See Also:
JOOX.matchAttr(String, String)
-
matchAttr
public final Match matchAttr(java.lang.String name, java.lang.String valueRegex, boolean keepMatches)
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)- Specified by:
matchAttrin interfaceMatch- See Also:
JOOX.matchAttr(String, String)
-
leaf
public final Impl leaf()
Description copied from interface:MatchReduce the set of matched elements to the ones that are leaf elements- Specified by:
leafin interfaceMatch- See Also:
JOOX.leaf()
-
after
public final Impl after(java.lang.String content)
Description copied from interface:MatchAdd content after each element in the set of matched elements.
-
after
public final Impl after(Content content)
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
public final Impl after(Match... content)
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
public final Impl after(org.w3c.dom.Element... content)
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
public final Impl before(java.lang.String content)
Description copied from interface:MatchAdd content before each element in the set of matched elements.
-
before
public final Impl before(Content content)
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
public final Impl before(Match... content)
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
public final Impl before(org.w3c.dom.Element... content)
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
public final Impl append(java.lang.String content)
Description copied from interface:MatchAppend content to the end of each element's content in the set of matched elements.
-
append
public final Impl append(Content content)
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
public final Impl append(Match... content)
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
public final Impl append(org.w3c.dom.Element... content)
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
public final Impl prepend(java.lang.String content)
Description copied from interface:MatchPrepend content to the beginning of each element's content in the set of matched elements.
-
prepend
public final Impl prepend(Content content)
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
public final Impl prepend(Match... content)
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
public final Impl prepend(org.w3c.dom.Element... content)
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
public final java.lang.String attr(java.lang.String name)
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
public final <T> T attr(java.lang.String name, java.lang.Class<T> type)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.
- Specified by:
attrin interfaceMatch- See Also:
JOOX.convert(String, Class)
-
attrs
public final java.util.List<java.lang.String> attrs(java.lang.String name)
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
public final <T> java.util.List<T> attrs(java.lang.String name, java.lang.Class<T> type)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.
- Specified by:
attrsin interfaceMatch- See Also:
JOOX.convert(String, Class)
-
attr
public final Impl attr(java.lang.String name, java.lang.String value)
Description copied from interface:MatchSet an attribute on all elements in the set of matched elements. Ifvalueis null, then the attribute is removed. If the attribute already exists, then it is replaced.
-
attr
public final Impl attr(java.lang.String name, Content content)
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
public final Impl removeAttr(java.lang.String name)
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
public final java.lang.String content()
Description copied from interface:MatchGet the XML content of the first element in the set of matched elements, ornullif there are no matched elements.This is the same as calling
content(0)
-
content
public final java.lang.String content(int index)
Description copied from interface:MatchGet the XML content at a given index in the current set of matched elements.
-
contents
public final java.util.List<java.lang.String> contents()
Description copied from interface:MatchGet all XML content of the elements in the set of matched elements.
-
contents
public final java.util.List<java.lang.String> contents(int... indexes)
Description copied from interface:MatchGet all XML content of the elements at given indexes in the set of matched elements.
-
content
private final java.lang.String content(org.w3c.dom.Element element)
-
content
public final Impl content(java.lang.String 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
public final Impl content(java.lang.Object content)
Description copied from interface:MatchAdd some JAXB-marshallable XML content to all elements in the set of matched elements (possibly replacing existing content).- Specified by:
contentin interfaceMatch- See Also:
JOOX.$(Object),JOOX.content(Object)
-
content
public final Impl content(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
public final java.lang.String text()
Description copied from interface:MatchGet the text content of the first element in the set of matched elements, ornullif there are no matched elements.This is the same as calling
text(0)
-
text
public final java.lang.String text(int index)
Description copied from interface:MatchGet the text content at a given index in the current set of matched elements.
-
text
public final <T> T text(java.lang.Class<T> type)
Description copied from interface:MatchGet the converted text content of the first element in the set of matched elements, ornullif there are no matched elements.- Specified by:
textin interfaceMatch- See Also:
JOOX.convert(String, Class)
-
texts
public final java.util.List<java.lang.String> texts()
Description copied from interface:MatchGet all text content of the elements in the set of matched elements.
-
texts
public final java.util.List<java.lang.String> texts(int... indexes)
Description copied from interface:MatchGet all text content of the elements at given indexes in the set of matched elements.
-
texts
public final <T> java.util.List<T> texts(java.lang.Class<T> type)
Description copied from interface:MatchGet all converted text content of the elements in the set of matched elements.- Specified by:
textsin interfaceMatch- See Also:
JOOX.convert(String, Class)
-
text
public final Impl text(java.lang.String content)
Description copied from interface:MatchSet some text content to all elements in the set of matched elements (possibly replacing existing content).
-
text
public final Impl text(Content content)
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
public final java.lang.String 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
public final java.lang.String cdata(int index)
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
public final <T> T cdata(java.lang.Class<T> type)
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).- Specified by:
cdatain interfaceMatch- See Also:
JOOX.convert(String, Class)
-
cdatas
public final java.util.List<java.lang.String> cdatas()
Description copied from interface:MatchGet all CDATA content of the elements in the set of matched elements.This is the same as
Match.texts().
-
cdatas
public final java.util.List<java.lang.String> cdatas(int... indexes)
Description copied from interface:MatchGet all CDATA content of the elements at given indexes in the set of matched elements.This is the same as
Match.texts(int...).
-
cdatas
public final <T> java.util.List<T> cdatas(java.lang.Class<T> type)
Description copied from interface:MatchGet all converted CDATA content of the elements in the set of matched elements.This is the same as
Match.texts(Class).- Specified by:
cdatasin interfaceMatch- See Also:
JOOX.convert(String, Class)
-
cdata
public final Impl cdata(java.lang.String content)
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
public final Impl cdata(Content content)
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
public final Match empty()
Description copied from interface:MatchRemoves all content from all elements in the set of matched elements.
-
remove
public final Impl remove()
Description copied from interface:MatchRemoves all elements from their parent nodes in the set of matched elements.
-
remove
public final Impl remove(java.lang.String selector)
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
- Specified by:
removein interfaceMatch- See Also:
JOOX.selector(String)
-
remove
public final Impl remove(Filter filter)
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
private final void remove(org.w3c.dom.Element element)
-
empty
private final void empty(org.w3c.dom.Element element)
-
wrap
public final Impl wrap(java.lang.String content)
Description copied from interface:MatchWrap all elements from their parent nodes in the set of matched elements in a new parent elementThe resulting set of matched elements contains the newly wrapped elements
- Specified by:
wrapin interfaceMatch- See Also:
Match.unwrap()
-
wrap
public final Impl wrap(Content content)
Description copied from interface:MatchWrap all elements in the set of matched elements in a new parent elementThe resulting set of matched elements contains the newly wrapped elements
- Specified by:
wrapin interfaceMatch- See Also:
Match.unwrap()
-
unwrap
public final Impl unwrap()
Description copied from interface:MatchRemoves all elements in the set of matched elements from their parentsThe resulting set of matched elements contains the newly unwrapped elements
- Specified by:
unwrapin interfaceMatch- See Also:
Match.wrap(String)
-
replaceWith
public final Impl replaceWith(java.lang.String content)
Description copied from interface:MatchReplace all elements in the set of matched elements with some new content.- Specified by:
replaceWithin interfaceMatch
-
replaceWith
public final Impl replaceWith(Content content)
Description copied from interface:MatchReplace all elements in the set of matched elements with some new content.- Specified by:
replaceWithin interfaceMatch
-
replaceWith
public final Impl replaceWith(Match... content)
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
public final Impl replaceWith(org.w3c.dom.Element... content)
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
public final Match rename(java.lang.String tag)
Description copied from interface:MatchRename all tags in the set of matched elements to some new tag name
-
rename
public final Match rename(Content tag)
Description copied from interface:MatchRename all tags in the set of matched elements to some new tag name
-
isFast
private final boolean isFast(Filter filter)
-
copy
public final Impl copy()
Description copied from interface:MatchGet a copy of theMatchwrapper. This is not a deep-copy of wrappedElementobjects. Both this and the copy will reference the sameElement's
-
xpath
public final java.lang.String xpath()
Description copied from interface:MatchGet an XPath expression describing the first element in the current set of matched elementsThis is the same as calling
xpath(0)
-
xpath
public final java.lang.String xpath(int index)
Description copied from interface:MatchGet an XPath expression describing the element at a given index in the current set of matched elements
-
xpaths
public final java.util.List<java.lang.String> xpaths()
Description copied from interface:MatchGet a list of XPath expressions describing the elements in the current set of matched elements
-
xpaths
public final java.util.List<java.lang.String> xpaths(int... indexes)
Description copied from interface:MatchGet a list of XPath expressions describing the elements at the given indexes in the current set of matched elements
-
tag
public final java.lang.String tag()
Description copied from interface:MatchGet the tag name of the first element in the current set of matched elements.This is the same as calling
tag(0)
-
tag
public final java.lang.String tag(int index)
Description copied from interface:MatchGet a tag name of the element at a given index in the current set of matched elements.
-
tags
public final java.util.List<java.lang.String> tags()
Description copied from interface:MatchGet a list of tag names of the elements in the current set of matched elements.
-
tags
public final java.util.List<java.lang.String> tags(int... indexes)
Description copied from interface:MatchGet a list of tag names of the elements at given indexes in the current set of matched elements.
-
id
public final java.lang.String id()
Description copied from interface:MatchGet the first id valueThis is the same as calling
id(0)
-
id
public final java.lang.String id(int index)
Description copied from interface:MatchGet 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
public final <T> T id(java.lang.Class<T> type)
Description copied from interface:MatchGet the first converted id value- Specified by:
idin interfaceMatch- See Also:
JOOX.convert(String, Class)
-
ids
public final java.util.List<java.lang.String> ids()
Description copied from interface:MatchGet a list of id values in the current set of matched elements.This is the same as calling
attrs("id")
-
ids
public final java.util.List<java.lang.String> ids(int... indexes)
Description copied from interface:MatchGet a list of id values at given indexes in the current set of matched elements.
-
ids
public final <T> java.util.List<T> ids(java.lang.Class<T> type)
Description copied from interface:MatchGet a list of converted id values in the current set of matched elements.- Specified by:
idsin interfaceMatch- See Also:
JOOX.convert(String, Class)
-
write
public final Match write(java.io.Writer writer) throws java.io.IOException
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
-
write
public final Match write(java.io.OutputStream stream) throws java.io.IOException
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
-
write
public final Match write(java.io.File file) throws java.io.IOException
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
-
unmarshal
public final <T> java.util.List<T> unmarshal(java.lang.Class<T> type)
Description copied from interface:MatchUnmarshal the current set of matched elements into a JAXB-annotated type.
-
unmarshal
public final <T> java.util.List<T> unmarshal(java.lang.Class<T> type, int... indexes)Description copied from interface:MatchUnmarshal the current set of matched elements at given indexes into a JAXB-annotated type.
-
unmarshalOne
public final <T> T unmarshalOne(java.lang.Class<T> type)
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
public final <T> T unmarshalOne(java.lang.Class<T> type, int index)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
public final Impl transform(javax.xml.transform.Transformer transformer)
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
public final Impl transform(javax.xml.transform.Source transformer)
Description copied from interface:MatchTransform all elements in the set of matched elements.- Specified by:
transformin interfaceMatch- See Also:
Match.transform(Transformer)
-
transform
public final Impl transform(java.io.InputStream transformer)
Description copied from interface:MatchTransform all elements in the set of matched elements.- Specified by:
transformin interfaceMatch- See Also:
Match.transform(Transformer)
-
transform
public final Impl transform(java.io.Reader transformer)
Description copied from interface:MatchTransform all elements in the set of matched elements.- Specified by:
transformin interfaceMatch- See Also:
Match.transform(Transformer)
-
transform
public final Impl transform(java.net.URL transformer)
Description copied from interface:MatchTransform all elements in the set of matched elements.- Specified by:
transformin interfaceMatch- See Also:
Match.transform(Transformer)
-
transform
public final Impl transform(java.io.File transformer)
Description copied from interface:MatchTransform all elements in the set of matched elements.- Specified by:
transformin interfaceMatch- See Also:
Match.transform(Transformer)
-
transform
public final Impl transform(java.lang.String transformer)
Description copied from interface:MatchTransform all elements in the set of matched elements.- Specified by:
transformin interfaceMatch- See Also:
Match.transform(Transformer)
-
sort
public Match sort(java.util.Comparator<org.w3c.dom.Element> comparator)
Description copied from interface:MatchAllows to sort the result with the given comparator.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
-