Class XMLPatterns

java.lang.Object
eu.bandm.tools.paisley.xml.XMLPatterns

@Generated(generator="eu.bandm.tools.expander", version="1.3.1", timestamp="2026-02-01T13:13:50") public abstract class XMLPatterns extends Object
Library of operations for pattern matching on XML document objects.
  • Method Details

    • tagName

      public static Pattern<Element> tagName(String 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 - if tagName is null
      See Also:
    • tagName

      public static Pattern<Element> tagName(Pattern<? super String> 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 - if tagName is null
      See Also:
    • namespaceURI

      public static Pattern<Node> namespaceURI(@Opt @Opt String namespaceURI)
      Returns a pattern that matches any XML node with the given namespace URI.
      Parameters:
      namespaceURI - a namespace URI, or null for unspecified
      Returns:
      a pattern that matches any XML node with the namespace URI namespaceURI
      See Also:
    • namespaceURI

      public static Pattern<Node> namespaceURI(Pattern<? super String> 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 - if namespaceURI is null
      See Also:
    • localName

      public static Pattern<Node> localName(@Opt @Opt String localName)
      Returns a pattern that matches any XML node with the given local name.
      Parameters:
      localName - a local name, or null for unspecified
      Returns:
      a pattern that matches any XML node with the local name localName
      See Also:
    • localName

      public static Pattern<Node> localName(Pattern<? super String> 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 - if localName is null
      See Also:
    • name

      public static Pattern<Node> name(@Opt @Opt String namespaceURI, @Opt @Opt String localName)
      Returns a pattern that matches any XML node with the given namespace URI and local name.
      Parameters:
      namespaceURI - a namespace URI, or null for unspecified
      localName - a local name, or null for unspecified
      Returns:
      a pattern that matches any XML node with the namespace URI namespaceURI and the local name localName
      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 URI
      localName - 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 by localName
      Throws:
      NullPointerException - if namespaceURI or localName is null
      See Also:
    • comment

      public static Pattern<Node> comment(Pattern<? super String> data)
      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 - if data is null
      See Also:
    • processingInstruction

      public static Motif<String,Node> processingInstruction(String target)
      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 - if target is null
      See Also:
    • processingInstruction

      public static Pattern<Node> 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.
      Parameters:
      target - the processing instruction target to recognize
      data - the pattern to match against the character data
      Returns:
      a pattern that matches data against the character data of any XML processing instruction node for target
      Throws:
      NullPointerException - if target or data is null
      See Also:
    • textContent

      public static Pattern<Node> textContent(Pattern<? super String> text)
      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 - if text is null
      See Also:
    • hasAttribute

      public static Pattern<Element> hasAttribute(String name)
      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 - if name is null
      See Also:
    • hasAttribute

      public static Pattern<Element> 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.
      Parameters:
      namespaceURI - an attribute namespace URI
      localName - an attribute local name
      Returns:
      a pattern that matches any XML element node that has an attribute with the namespace URI namespaceURI and the local name localName
      Throws:
      NullPointerException - if namespaceURI or localName is null
      See Also:
    • attributeNode

      public static Motif<Attr,Element> attributeNode(String name)
      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 name of any XML element node
      Throws:
      NullPointerException - is name is null
    • attributeNode

      public static Pattern<Element> 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.

      If the target node does not have an attribute with the expected name, there is no match.

      Parameters:
      name - the attribute name
      body - 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 - is name or body is null
    • attributeNode

      public static Motif<Attr,Element> 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.

      If the target node does not have an attribute with the expected name, there is no match.

      Parameters:
      namespaceURI - an attribute namespace URI
      localName - an attribute local name
      Returns:
      a motif that binds the attribute node with the namespace URI namespaceURI and the local name localName of any XML element node
      Throws:
      NullPointerException - is namespaceURI or localName is 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 URI
      localName - an attribute local name
      body - the pattern to match against the attribute node
      Returns:
      a pattern that matches body against the attribute node with the namespace URI namespaceURI and the local name localName of any XML element node
      Throws:
      NullPointerException - is namespaceURI, localName or body is null
    • attribute

      public static Motif<String,Element> attribute(String name)
      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 name of any XML element node
      Throws:
      NullPointerException - if name is null
      See Also:
    • attribute

      public static Pattern<Element> attribute(String name, Pattern<? super String> body)
      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 name
      body - the pattern to match against the attribute value
      Returns:
      a pattern that matches body against the value of the attribute with the name name of any XML element node
      Throws:
      NullPointerException - if name or body is null
      See Also:
    • attribute

      public static Motif<String,Element> attribute(String namespaceURI, String localName)
      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 URI
      localName - the attribute local name
      Returns:
      a pattern that binds the value of the attribute with the namespace URI namespaceURI and local name localName of any XML element node
      Throws:
      NullPointerException - if namespaceURI or localName is 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 URI
      localName - the attribute local name
      body - the pattern to match against the attribute value
      Returns:
      a pattern that matches body against the value of the attribute with the namespace URI namespaceURI and local name localName of any XML element node
      Throws:
      NullPointerException - if namespaceURI, localName or body is null
      See Also:
    • attribute

      public static Pattern<Element> attribute(Pattern<? super Attr> body)
      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 body disjunctively against each attribute of some XML element node
      Throws:
      NullPointerException - if body is null
      See Also:
    • element

      public static Pattern<Node> element(Pattern<? super Element> body)
      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 - if body is null
    • rootElement

      public static Pattern<Document> rootElement(Pattern<? super Element> body)
      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 body against the root element of an XML document node
      Throws:
      NullPointerException - if body is null}
      See Also:
    • ownerDocument

      public static Pattern<Node> ownerDocument(Pattern<? super Document> body)
      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 body against the owner document of any XML node
      Throws:
      NullPointerException - if body is null
      See Also:
    • ownerDocumentOrSelf

      public static Pattern<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.
      Parameters:
      body - the pattern to match against the owner document node
      Returns:
      a pattern that matches body against the owner document of any XML node, or itself if the node is a document
      Throws:
      NullPointerException - if body is null
      See Also:
    • child

      public static Pattern<Node> child(Pattern<? super Node> body)
      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 body disjunctively against each child of some XML node in sequence
      Throws:
      NullPointerException - if body is null
      See Also:
    • nextSibling

      public static Pattern<Node> 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.
      Parameters:
      body - the pattern to match against the next sibling
      Returns:
      a pattern that matches body against the next sibling of some XML node, if there is one; otherwise there is no match
      Throws:
      NullPointerException - if body is null
      See Also:
    • previousSibling

      public static Pattern<Node> 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.
      Parameters:
      body - the pattern to match against the previous sibling
      Returns:
      a pattern that matches body against the previous sibling of some XML node, if there is one; otherwise there is no match
      Throws:
      NullPointerException - if body is null
      See Also:
    • parent

      public static Pattern<Node> parent(Pattern<? super Node> body)
      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 body against the parent of some XML node, if there is one; otherwise there is no match
      Throws:
      NullPointerException - if body is null
      See Also: