Java XPath Create getXpath()

Here you can find the source of getXpath()

Description

get Xpath

License

Apache License

Declaration

public static XPath getXpath() 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import javax.xml.xpath.XPath;

import javax.xml.xpath.XPathFactory;

public class Main {
    private static final ThreadLocal<XPath> xpathTL = new ThreadLocal<XPath>();

    public static XPath getXpath() {
        try {/*  www .j  a  v  a  2s .  c  o  m*/
            XPath xpath = xpathTL.get();
            if (xpath == null) {
                xpath = XPathFactory.newInstance().newXPath();
                xpathTL.set(xpath);
            }
            return xpath;
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
}

Related

  1. getXmlString(Node inXml, String xpath)
  2. getXPath()
  3. getXPath()
  4. getxPath()
  5. getXPath()