/** * Create a new <code>XPathReader</code> with a do-nothing * <code>XPathHandler</code>. */ public XPathReader() { setXPathHandler( defaultHandler ); }
/** * @param args String[] * @throws SAXPathException */ public static void main(String[] args) throws SAXPathException { XPathReader reader = new XPathReader(); reader.setXPathHandler(new DebugXPathHandler()); reader .parse("/ns:one[@woof='dog']/two/./../two[functionTest(@a, @b, $woof:woof)]/three/*/four//*/five/six[@exists1 and @exists2]"); }
/** * @param args String[] * @throws SAXPathException */ public static void main(String[] args) throws SAXPathException { XPathReader reader = new XPathReader(); reader.setXPathHandler(new DebugXPathHandler()); reader .parse("/ns:one[@woof='dog']/two/./../two[functionTest(@a, @b, $woof:woof)]/three/*/four//*/five/six[@exists1 and @exists2]"); }
static Query getPathQuery(String path) throws SAXPathException { ApplicationContext ac = ApplicationContextHelper.getApplicationContext(); XPathReader reader = new XPathReader(); LuceneXPathHandler handler = new LuceneXPathHandler(); handler.setNamespacePrefixResolver((NamespaceService) ac.getBean("namespaceService")); handler.setDictionaryService((DictionaryService) ac.getBean("dictionaryService")); reader.setXPathHandler(handler); reader.parse(path); PathQuery pathQuery = handler.getQuery(); pathQuery.setRepeats(false); return pathQuery; }
static Query getPathQuery(String path) throws SAXPathException { ApplicationContext ac = ApplicationContextHelper.getApplicationContext(); XPathReader reader = new XPathReader(); LuceneXPathHandler handler = new LuceneXPathHandler(); handler.setNamespacePrefixResolver((NamespaceService) ac.getBean("namespaceService")); handler.setDictionaryService((DictionaryService) ac.getBean("dictionaryService")); reader.setXPathHandler(handler); reader.parse(path); PathQuery pathQuery = handler.getQuery(); pathQuery.setRepeats(false); return pathQuery; }