Java tutorial
//package com.java2s; import com.sun.org.apache.xpath.internal.jaxp.XPathFactoryImpl; import javax.xml.xpath.XPathFactory; public class Main { public static XPathFactory newXPathFactory() { XPathFactory ret = null; if (ret == null) try { ret = XPathFactory.newInstance(); } catch (Exception exception) { } if (ret == null) try { new XPathFactoryImpl(); } catch (Exception exception1) { } if (ret == null) System.out.println("Error: Can't find XPathFactory"); return ret; } }