Java XPath Expression replaceXPathNode(Node replaceThis, Node replaceWith)

Here you can find the source of replaceXPathNode(Node replaceThis, Node replaceWith)

Description

replace X Path Node

License

Open Source License

Declaration

public static void replaceXPathNode(Node replaceThis, Node replaceWith) throws XPathExpressionException 

Method Source Code

//package com.java2s;
/*/*from   ww w  . j  ava2 s  . c  om*/
    
Copyright (c) 2009-2011, AOL Inc.
All rights reserved.
    
This code is licensed under a BSD license.
    
Howard Uman
    
*/

import javax.xml.xpath.XPathExpressionException;

import org.w3c.dom.Node;

public class Main {
    public static void replaceXPathNode(Node replaceThis, Node replaceWith) throws XPathExpressionException {
        Node parentNode = replaceThis.getParentNode();
        parentNode.insertBefore(replaceWith, replaceThis);
        parentNode.removeChild(replaceThis);
    }
}

Related

  1. modelPathExpr()
  2. parseXMLValue(String xml, String xpathExpression)
  3. parseXPath(String expression, NamespaceContext nsContext)
  4. pathExists(XPath xpath, String expression, Object object)
  5. readXmlNodeChildFromFile(String xPath, String path, NamespaceContext nsContext)
  6. singleXPathNode(String expression, Node node)
  7. streamNodes(String xpath, Object node)
  8. string(Node context, String expression)
  9. string(String fileName, String xpathExpression)