Class AbstractXPathAction<T>

    • Constructor Summary

      Constructors 
      Constructor Description
      AbstractXPathAction​(org.jdom2.xpath.XPathFactory xpathFactory, String xpath, org.jdom2.filter.Filter<T> filter, Map<String,​String> prefixToNamespaceMap)
      Construct a new AbstractXPathAction based on an XPath string, a JDOM Filter<T> using the provided namespace map to map XML prefixes to namespaces.
    • Constructor Detail

      • AbstractXPathAction

        public AbstractXPathAction​(org.jdom2.xpath.XPathFactory xpathFactory,
                                   String xpath,
                                   org.jdom2.filter.Filter<T> filter,
                                   Map<String,​String> prefixToNamespaceMap)
        Construct a new AbstractXPathAction based on an XPath string, a JDOM Filter<T> using the provided namespace map to map XML prefixes to namespaces.
        Parameters:
        xpathFactory - the XPath implementation to use
        xpath - the XPath string
        filter - a filter to determine the types of nodes to return
        prefixToNamespaceMap - a map of XML prefixes to namespaces used in the provided XPath
    • Method Detail

      • getXpath

        public org.jdom2.xpath.XPathExpression<T> getXpath()
        Description copied from interface: XPathAction
        Retrieves the compiled XPath expression.
        Specified by:
        getXpath in interface XPathAction<T>
        Returns:
        a compiled XPath expression
      • resolveXpath

        protected List<T> resolveXpath​(org.jdom2.Document document)
                                throws ActionException
        Resolves the XPath expression against the provided document, returning the nodeset.
        Parameters:
        document - the document to query against
        Returns:
        a list of matching nodes
        Throws:
        ActionException - if an error occurs while resolving the XPath expression
      • execute

        public void execute​(org.jdom2.Document document)
                     throws ActionException
        Description copied from interface: Action
        Apply the action to an XML document, making the required modifications.
        Specified by:
        execute in interface Action
        Parameters:
        document - the document to apply the action to
        Throws:
        ActionException - if an error occurs while applying the action to the document
      • process

        protected abstract void process​(List<T> results)
                                 throws ActionException
        Perform the implemented action on the provided XPath results.
        Parameters:
        results - a list of XPath results guaranteed to be non-empty
        Throws:
        ActionException - if an error occurs while processing the implemented action