Class XMLPatterns
-
Method Summary
Modifier and TypeMethodDescriptionReturns a pattern that matches a given pattern disjunctively against each attribute of some XML element node.Returns a motif that binds the value of the attribute with the given name of any XML element node.Returns a pattern that matches the given pattern against the value of the attribute with the given name of any XML element node.Returns a motif that binds the value of the attribute with the given namespace URI and local name of any XML element node.Returns a pattern that matches the given pattern against the value of the attribute with the given namespace URI and local name of any XML element node.attributeNode(String name) Returns a motif that binds the attribute node with the given name of any XML element node.attributeNode(String name, Pattern<? super Attr> body) Returns a pattern that matches the given pattern against the attribute node with the given name of any XML element node.attributeNode(String namespaceURI, String localName) Returns a motif that binds the attribute node with the given namespace URI and local name of any XML element node.attributeNode(String namespaceURI, String localName, Pattern<? super Attr> body) Returns a pattern that matches the given pattern against the attribute node with the given namespace URI and local name of any XML element node.Returns a pattern that matches the given pattern disjunctively against each child of some XML node in sequence.Returns a pattern that matches any XML comment node whose character data is matched by the given pattern.Returns a pattern that matches the given pattern against an XML node if it is an element.hasAttribute(String name) Returns a pattern that matches any XML element node that has an attribute with the given name.hasAttribute(String namespaceURI, String localName) Returns a pattern that matches any XML element node that has an attribute with the given namespace URI and local name.Returns a pattern that matches any XML node whose local name matches the given pattern.Returns a pattern that matches any XML node with the given local name.Returns a pattern that matches any XML node whose namespace URI and local name match the given patterns, respectively.Returns a pattern that matches any XML node with the given namespace URI and local name.namespaceURI(Pattern<? super String> namespaceURI) Returns a pattern that matches any XML node whose namespace URI matches the given pattern.namespaceURI(@Opt String namespaceURI) Returns a pattern that matches any XML node with the given namespace URI.nextSibling(Pattern<? super Node> body) Returns a pattern that matches a given pattern against the next sibling of some XML node, if there is one.ownerDocument(Pattern<? super Document> body) Returns a pattern that matches the given pattern against the owner document of any XML node.ownerDocumentOrSelf(Pattern<? super Document> body) Returns a pattern that matches the given pattern against the owner document of any XML node, or itself if the node is a document.Returns a patterns that matches a given pattern against the parent of some XML node, if there is one.previousSibling(Pattern<? super Node> body) Returns a pattern that matches a given pattern against the previous sibling of some XML node, if there is one.processingInstruction(String target) Returns a motif that binds the character data of any XML processing instruction node with the given target.processingInstruction(String target, Pattern<? super String> data) Returns a pattern that matches any XML processing instruction with the given target whose character data is matched by the given pattern.rootElement(Pattern<? super Element> body) Returns a pattern that matches the given pattern against the root element of an XML document node.Returns a pattern that matches any XML element node whose tag name matches the given pattern.Returns a pattern that matches any XML element node with the given tag name.textContent(Pattern<? super String> text) Returns a pattern that matches any XML node whose text context is matched by the given pattern.
-
Method Details
-
tagName
Returns a pattern that matches any XML element node with the given tag name.- Parameters:
tagName- an XML tag name- Returns:
- a pattern that matches any XML element node with the name
tagName - Throws:
NullPointerException- iftagNameis null- See Also:
-
tagName
Returns a pattern that matches any XML element node whose tag name matches the given pattern.- Parameters:
tagName- a pattern to match against XML tag name- Returns:
- a pattern that matches any XML element node whose tag name is
matched by
tagName - Throws:
NullPointerException- iftagNameis null- See Also:
-
namespaceURI
Returns a pattern that matches any XML node with the given namespace URI.- Parameters:
namespaceURI- a namespace URI, ornullfor unspecified- Returns:
- a pattern that matches any XML node with the namespace URI
namespaceURI - See Also:
-
namespaceURI
Returns a pattern that matches any XML node whose namespace URI matches the given pattern.- Parameters:
namespaceURI- a pattern to match against the namespace URI- Returns:
- a pattern that matches any XML node whose namespace URI is matched
by
namespaceURI - Throws:
NullPointerException- ifnamespaceURIis null- See Also:
-
localName
Returns a pattern that matches any XML node with the given local name.- Parameters:
localName- a local name, ornullfor unspecified- Returns:
- a pattern that matches any XML node with the local name
localName - See Also:
-
localName
Returns a pattern that matches any XML node whose local name matches the given pattern.- Parameters:
localName- a pattern to match against the local name- Returns:
- a pattern that matches any XML node whose local name is matched by
localName - Throws:
NullPointerException- iflocalNameis null- See Also:
-
name
Returns a pattern that matches any XML node with the given namespace URI and local name.- Parameters:
namespaceURI- a namespace URI, ornullfor unspecifiedlocalName- a local name, ornullfor unspecified- Returns:
- a pattern that matches any XML node with the namespace URI
namespaceURIand the local namelocalName - See Also:
-
name
public static Pattern<Node> name(Pattern<? super String> namespaceURI, Pattern<? super String> localName) Returns a pattern that matches any XML node whose namespace URI and local name match the given patterns, respectively.- Parameters:
namespaceURI- a pattern to match against the namespace URIlocalName- a pattern to match against the local name- Returns:
- a pattern that matches any XML node whose namespace URI is matched
by
namespaceURI, and whose local name is matched bylocalName - Throws:
NullPointerException- ifnamespaceURIorlocalNameis null- See Also:
-
comment
Returns a pattern that matches any XML comment node whose character data is matched by the given pattern.- Parameters:
data- a pattern to match against the character data- Returns:
- a pattern that matches any XML comment node whose character data
is matched by
data - Throws:
NullPointerException- ifdatais null- See Also:
-
processingInstruction
Returns a motif that binds the character data of any XML processing instruction node with the given target.- Parameters:
target- the processing instruction target to recognize- Returns:
- a motif that binds the character data of any XML processing
instruction node for
target - Throws:
NullPointerException- iftargetis null- See Also:
-
processingInstruction
Returns a pattern that matches any XML processing instruction with the given target whose character data is matched by the given pattern.- Parameters:
target- the processing instruction target to recognizedata- the pattern to match against the character data- Returns:
- a pattern that matches
dataagainst the character data of any XML processing instruction node fortarget - Throws:
NullPointerException- iftargetordatais null- See Also:
-
textContent
Returns a pattern that matches any XML node whose text context is matched by the given pattern.- Parameters:
text- the pattern to match against the text content- Returns:
- a pattern that matches any XML node whose text context is matched
by
text - Throws:
NullPointerException- iftextis null- See Also:
-
hasAttribute
Returns a pattern that matches any XML element node that has an attribute with the given name.- Parameters:
name- an attribute name- Returns:
- a pattern that matches any XML element node that has an attribute
with the name
name - Throws:
NullPointerException- ifnameis null- See Also:
-
hasAttribute
Returns a pattern that matches any XML element node that has an attribute with the given namespace URI and local name.- Parameters:
namespaceURI- an attribute namespace URIlocalName- an attribute local name- Returns:
- a pattern that matches any XML element node that has an attribute
with the namespace URI
namespaceURIand the local namelocalName - Throws:
NullPointerException- ifnamespaceURIorlocalNameis null- See Also:
-
attributeNode
Returns a motif that binds the attribute node with the given name of any XML element node.If the target node does not have an attribute with the expected name, there is no match.
- Parameters:
name- the attribute name- Returns:
- a motif that binds the attribute node with the name
nameof any XML element node - Throws:
NullPointerException- isnameis null
-
attributeNode
Returns a pattern that matches the given pattern against the attribute node with the given name of any XML element node.If the target node does not have an attribute with the expected name, there is no match.
- Parameters:
name- the attribute namebody- the pattern to match against the attribute node- Returns:
- a pattern that matches the given pattern against the attribute node with the given name of any XML element node
- Throws:
NullPointerException- isnameorbodyis null
-
attributeNode
Returns a motif that binds the attribute node with the given namespace URI and local name of any XML element node.If the target node does not have an attribute with the expected name, there is no match.
- Parameters:
namespaceURI- an attribute namespace URIlocalName- an attribute local name- Returns:
- a motif that binds the attribute node with the namespace URI
namespaceURIand the local namelocalNameof any XML element node - Throws:
NullPointerException- isnamespaceURIorlocalNameis null
-
attributeNode
public static Pattern<Element> attributeNode(String namespaceURI, String localName, Pattern<? super Attr> body) Returns a pattern that matches the given pattern against the attribute node with the given namespace URI and local name of any XML element node.If the target node does not have an attribute with the expected name, there is no match.
- Parameters:
namespaceURI- an attribute namespace URIlocalName- an attribute local namebody- the pattern to match against the attribute node- Returns:
- a pattern that matches
bodyagainst the attribute node with the namespace URInamespaceURIand the local namelocalNameof any XML element node - Throws:
NullPointerException- isnamespaceURI,localNameorbodyis null
-
attribute
Returns a motif that binds the value of the attribute with the given name of any XML element node.If the target node does not have an attribute with the expected name, there is no match.
- Parameters:
name- the attribute name- Returns:
- a pattern that binds the value of the attribute with the name
nameof any XML element node - Throws:
NullPointerException- ifnameis null- See Also:
-
attribute
Returns a pattern that matches the given pattern against the value of the attribute with the given name of any XML element node.If the target node does not have an attribute with the expected name, there is no match.
- Parameters:
name- the attribute namebody- the pattern to match against the attribute value- Returns:
- a pattern that matches
bodyagainst the value of the attribute with the namenameof any XML element node - Throws:
NullPointerException- ifnameorbodyis null- See Also:
-
attribute
Returns a motif that binds the value of the attribute with the given namespace URI and local name of any XML element node.If the target node does not have an attribute with the expected name, there is no match.
- Parameters:
namespaceURI- the attribute namespace URIlocalName- the attribute local name- Returns:
- a pattern that binds the value of the attribute with the namespace
URI
namespaceURIand local namelocalNameof any XML element node - Throws:
NullPointerException- ifnamespaceURIorlocalNameis null- See Also:
-
attribute
public static Pattern<Element> attribute(String namespaceURI, String localName, Pattern<? super String> body) Returns a pattern that matches the given pattern against the value of the attribute with the given namespace URI and local name of any XML element node.If the target node does not have an attribute with the expected name, there is no match.
- Parameters:
namespaceURI- the attribute namespace URIlocalName- the attribute local namebody- the pattern to match against the attribute value- Returns:
- a pattern that matches
bodyagainst the value of the attribute with the namespace URInamespaceURIand local namelocalNameof any XML element node - Throws:
NullPointerException- ifnamespaceURI,localNameorbodyis null- See Also:
-
attribute
Returns a pattern that matches a given pattern disjunctively against each attribute of some XML element node.The order in which attributes of an element are enumerated is implementation-specific, and should not be considered significant.
- Parameters:
body- the pattern to match against each attribute node- Returns:
- a pattern that matches
bodydisjunctively against each attribute of some XML element node - Throws:
NullPointerException- ifbodyis null- See Also:
-
element
Returns a pattern that matches the given pattern against an XML node if it is an element.- Parameters:
body- the pattern to match against the element node- Returns:
- a pattern that matches the given pattern against an XML node if it is an element
- Throws:
NullPointerException- ifbodyis null
-
rootElement
Returns a pattern that matches the given pattern against the root element of an XML document node.- Parameters:
body- the pattern to match against the root element node- Returns:
- a pattern that matches
bodyagainst the root element of an XML document node - Throws:
NullPointerException- ifbodyis null}- See Also:
-
ownerDocument
Returns a pattern that matches the given pattern against the owner document of any XML node.Note that, by definition, a document does not own itself; in that case there is no match.
- Parameters:
body- the pattern to match against the owner document node- Returns:
- a pattern that matches the
bodyagainst the owner document of any XML node - Throws:
NullPointerException- ifbodyis null- See Also:
-
ownerDocumentOrSelf
Returns a pattern that matches the given pattern against the owner document of any XML node, or itself if the node is a document.- Parameters:
body- the pattern to match against the owner document node- Returns:
- a pattern that matches
bodyagainst the owner document of any XML node, or itself if the node is a document - Throws:
NullPointerException- ifbodyis null- See Also:
-
child
Returns a pattern that matches the given pattern disjunctively against each child of some XML node in sequence.- Parameters:
body- the pattern to match against each child- Returns:
- a pattern that matches
bodydisjunctively against each child of some XML node in sequence - Throws:
NullPointerException- ifbodyis null- See Also:
-
nextSibling
Returns a pattern that matches a given pattern against the next sibling of some XML node, if there is one.- Parameters:
body- the pattern to match against the next sibling- Returns:
- a pattern that matches
bodyagainst the next sibling of some XML node, if there is one; otherwise there is no match - Throws:
NullPointerException- ifbodyis null- See Also:
-
previousSibling
Returns a pattern that matches a given pattern against the previous sibling of some XML node, if there is one.- Parameters:
body- the pattern to match against the previous sibling- Returns:
- a pattern that matches
bodyagainst the previous sibling of some XML node, if there is one; otherwise there is no match - Throws:
NullPointerException- ifbodyis null- See Also:
-
parent
Returns a patterns that matches a given pattern against the parent of some XML node, if there is one.- Parameters:
body- the pattern to match against the parent- Returns:
- a pattern that matches
bodyagainst the parent of some XML node, if there is one; otherwise there is no match - Throws:
NullPointerException- ifbodyis null- See Also:
-