Class 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 Detail

      • log

        protected transient org.slf4j.Logger log
    • Constructor Detail

      • ReplaceNode

        public ReplaceNode()
      • ReplaceNode

        public ReplaceNode​(java.lang.String xpath)
    • 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 Document
        newDoc - 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 -