Package com.adaptris.util.text.xml
Class ReplaceNode
- java.lang.Object
-
- com.adaptris.util.text.xml.XpathMergeImpl
-
- com.adaptris.util.text.xml.ReplaceNode
-
- All Implemented Interfaces:
DocumentMerge
public class ReplaceNode extends XpathMergeImpl
Merge implementation that replaces a node derived from an Xpath.If the
DocumentBuilderFactoryBuilder
has been explicitly set to be not namespace aware and the document does in fact contain namespaces, then Saxon can cause merry havoc in the sense that//NonNamespaceXpath
doesn't work if the document has namespaces in it. We have included a shim so that behaviour can be toggled based on what you have configured.- See Also:
XPath.newXPathInstance(DocumentBuilderFactoryBuilder, NamespaceContext)
In the adapter configuration file this class is aliased as xml-replace-node which is the preferred alternative to the fully qualified classname when building your configuration.
-
-
Field Summary
Fields Modifier and Type Field Description protected org.slf4j.Logger
log
-
Constructor Summary
Constructors Constructor Description ReplaceNode()
ReplaceNode(java.lang.String xpath)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getXpathToNode()
org.w3c.dom.Document
merge(org.w3c.dom.Document original, org.w3c.dom.Document newDoc)
Merge the contents of two XML documentsvoid
setXpathToNode(java.lang.String xpath)
Set the xpath to discover the node to be replaced.-
Methods inherited from class com.adaptris.util.text.xml.XpathMergeImpl
create, createXPath, getNamespaceContext, getXmlDocumentFactoryConfig, setNamespaceContext, setXmlDocumentFactoryConfig
-
-
-
-
Method Detail
-
merge
public org.w3c.dom.Document merge(org.w3c.dom.Document original, org.w3c.dom.Document newDoc) throws java.lang.Exception
Description copied from interface:DocumentMerge
Merge the contents of two XML documents- Parameters:
original
- the original DocumentnewDoc
- the document to merge- Returns:
- the merged document
- Throws:
java.lang.Exception
-
getXpathToNode
public java.lang.String getXpathToNode()
-
setXpathToNode
public void setXpathToNode(java.lang.String xpath)
Set the xpath to discover the node to be replaced.- Parameters:
xpath
-
-
-