Class AddAttributeAction
- 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.AddAttributeAction
-
- All Implemented Interfaces:
Action,XPathAction<org.jdom2.Element>
public class AddAttributeAction extends AbstractXPathAction<org.jdom2.Element>
Adds a new XML attribute to an exiting element.
-
-
Constructor Summary
Constructors Constructor Description AddAttributeAction(org.jdom2.xpath.XPathFactory xpathFactory, String xpath, Map<String,String> prefixToNamespaceMap, String namespace, String name, String value)Construct a new AddAttributeAction based on an XPath string using the provided map to map XML prefixes to namespaces.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetName()Retrieve the name of the new attribute.StringgetNamespace()Retrieve the namespace URI to use for the new attribute.StringgetValue()Retrieve the new attribute's value.protected voidprocess(List<org.jdom2.Element> results)Appends an attribute to each resultingElement.-
Methods inherited from class gov.nist.secauto.decima.xml.templating.document.post.template.AbstractXPathAction
execute, getXpath, resolveXpath
-
-
-
-
Constructor Detail
-
AddAttributeAction
public AddAttributeAction(org.jdom2.xpath.XPathFactory xpathFactory, String xpath, Map<String,String> prefixToNamespaceMap, String namespace, String name, String value)Construct a new AddAttributeAction based on an XPath string using the provided map to map XML prefixes to namespaces.- Parameters:
xpathFactory- the XPath implementation to usexpath- the XPath stringprefixToNamespaceMap- a map of XML prefixes to namespaces used in the provided XPathnamespace- the namespace of the new attribute ornullif the attribute has no namespacename- the name of the new attributevalue- the value of the new attrubute
-
-
Method Detail
-
getNamespace
public String getNamespace()
Retrieve the namespace URI to use for the new attribute.- Returns:
- the namespace URI
-
getName
public String getName()
Retrieve the name of the new attribute.- Returns:
- the attribute's name
-
getValue
public String getValue()
Retrieve the new attribute's value.- Returns:
- the new attributes value
-
process
protected void process(List<org.jdom2.Element> results) throws ActionException
Appends an attribute to each resultingElement.- 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
-
-