Class ReplaceAction
- java.lang.Object
-
- gov.nist.secauto.decima.xml.templating.document.post.template.AbstractXPathAction<org.jdom2.Element>
-
- gov.nist.secauto.decima.xml.templating.document.post.template.ReplaceAction
-
- All Implemented Interfaces:
Action,XPathAction<org.jdom2.Element>
public class ReplaceAction extends AbstractXPathAction<org.jdom2.Element>
Replaces existing elements returned by an XPath query over an XML document with one or more new elements.
-
-
Constructor Summary
Constructors Constructor Description ReplaceAction(org.jdom2.xpath.XPathFactory xpathFactory, String xpath, Map<String,String> prefixToNamespaceMap, List<org.jdom2.Element> contentNodes)Construct a new ReplaceAction based on an XPath string using the provided map to map XML prefixes to namespaces within the XPath.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<org.jdom2.Element>getContentNodes()Retrieves the elements to use as the replacement.protected voidprocess(List<org.jdom2.Element> results)Replaces existing elements based on the provided XPath results.-
Methods inherited from class gov.nist.secauto.decima.xml.templating.document.post.template.AbstractXPathAction
execute, getXpath, resolveXpath
-
-
-
-
Constructor Detail
-
ReplaceAction
public ReplaceAction(org.jdom2.xpath.XPathFactory xpathFactory, String xpath, Map<String,String> prefixToNamespaceMap, List<org.jdom2.Element> contentNodes)Construct a new ReplaceAction based on an XPath string using the provided map to map XML prefixes to namespaces within the XPath.- Parameters:
xpathFactory- the XPath implementation to usexpath- the XPath stringprefixToNamespaceMap- a map of XML prefixes to namespaces used in the provided XPathcontentNodes- a list of new elements to use as the replacement
-
-
Method Detail
-
getContentNodes
public List<org.jdom2.Element> getContentNodes()
Retrieves the elements to use as the replacement.- Returns:
- a list of elements
-
process
protected void process(List<org.jdom2.Element> results) throws ActionException
Replaces existing elements based on the provided XPath results.- Specified by:
processin classAbstractXPathAction<org.jdom2.Element>- Parameters:
results- a list of XPath results guaranteed to be non-empty- Throws:
ActionException- if an error occurs while processing the implemented action
-
-