Here you can find the source of getXPath(NamespaceContext nsContext)
public static XPath getXPath(NamespaceContext nsContext)
//package com.java2s; //License from project: Open Source License import javax.xml.namespace.NamespaceContext; import javax.xml.xpath.*; public class Main { public static XPath getXPath(NamespaceContext nsContext) { XPath xpath = XPathFactory.newInstance().newXPath(); if (nsContext != null) xpath.setNamespaceContext(nsContext); return xpath; }/* ww w . j a va 2s . c o m*/ }