本文整理汇总了Java中org.jaxen.saxpath.base.XPathReader.parse方法的典型用法代码示例。如果您正苦于以下问题:Java XPathReader.parse方法的具体用法?Java XPathReader.parse怎么用?Java XPathReader.parse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jaxen.saxpath.base.XPathReader
的用法示例。
在下文中一共展示了XPathReader.parse方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createAssocTypeQNameQuery
import org.jaxen.saxpath.base.XPathReader; //导入方法依赖的package包/类
protected Query createAssocTypeQNameQuery(String queryText) throws SAXPathException
{
// This was broken and using only FIELD_PRIMARYASSOCTYPEQNAME
// The field was also not indexed correctly.
// We do both for backward compatability ...
BooleanQuery booleanQuery = new BooleanQuery();
XPathReader reader = new XPathReader();
SolrXPathHandler handler = new SolrXPathHandler();
handler.setNamespacePrefixResolver(namespacePrefixResolver);
handler.setDictionaryService(dictionaryService);
reader.setXPathHandler(handler);
reader.parse("//" + queryText);
SolrPathQuery pathQuery = handler.getQuery();
pathQuery.setPathField(FIELD_ASSOCTYPEQNAME);
booleanQuery.add(new SolrCachingPathQuery(pathQuery), Occur.SHOULD);
booleanQuery.add(createPrimaryAssocTypeQNameQuery(queryText), Occur.SHOULD);
return getNonEmptyBooleanQuery(booleanQuery);
}
示例2: createAssocTypeQNameQuery
import org.jaxen.saxpath.base.XPathReader; //导入方法依赖的package包/类
protected Query createAssocTypeQNameQuery(String queryText) throws SAXPathException
{
// This was broken and using only FIELD_PRIMARYASSOCTYPEQNAME
// The field was also not indexed correctly.
// We do both for backward compatability ...
BooleanQuery booleanQuery = new BooleanQuery();
XPathReader reader = new XPathReader();
LuceneXPathHandler handler = new LuceneXPathHandler();
handler.setNamespacePrefixResolver(namespacePrefixResolver);
handler.setDictionaryService(dictionaryService);
reader.setXPathHandler(handler);
reader.parse("//" + queryText);
PathQuery query = handler.getQuery();
query.setPathField(FIELD_PATH);
query.setQnameField(FIELD_ASSOCTYPEQNAME);
booleanQuery.add(query, Occur.SHOULD);
booleanQuery.add(createPrimaryAssocTypeQNameQuery(queryText), Occur.SHOULD);
return booleanQuery;
}
示例3: createQNameQuery
import org.jaxen.saxpath.base.XPathReader; //导入方法依赖的package包/类
protected Query createQNameQuery(String queryText) throws SAXPathException
{
XPathReader reader = new XPathReader();
LuceneXPathHandler handler = new LuceneXPathHandler();
handler.setNamespacePrefixResolver(namespacePrefixResolver);
handler.setDictionaryService(dictionaryService);
reader.setXPathHandler(handler);
reader.parse(queryText);
PathQuery query = handler.getQuery();
// if it matches all docs
if ((query.getPathStructuredFieldPositions().size() == 0) && (query.getQNameStructuredFieldPositions().size() == 2))
{
if (query.getQNameStructuredFieldPositions().get(0).getTermText().equals(PathTokenFilter.NO_NS_TOKEN_TEXT))
{
return createTermQuery(FIELD_QNAME, queryText);
}
}
return createPathQuery("//" + queryText, false);
}
示例4: getPathQuery
import org.jaxen.saxpath.base.XPathReader; //导入方法依赖的package包/类
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;
}
示例5: main
import org.jaxen.saxpath.base.XPathReader; //导入方法依赖的package包/类
/**
* @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]");
}
示例6: isValidXpathQuery
import org.jaxen.saxpath.base.XPathReader; //导入方法依赖的package包/类
/**
* Validation Xpath query
*
* @param query xpath query
* @return true if xpath query valid
*/
public boolean isValidXpathQuery(String query)
{
try
{
XPathReader reader = new XPathReader();
reader.parse(query);
}
catch (Exception e)
{
return false;
}
return true;
}
示例7: createPathQuery
import org.jaxen.saxpath.base.XPathReader; //导入方法依赖的package包/类
protected Query createPathQuery(String queryText, boolean withRepeats) throws SAXPathException
{
XPathReader reader = new XPathReader();
SolrXPathHandler handler = new SolrXPathHandler();
handler.setNamespacePrefixResolver(namespacePrefixResolver);
handler.setDictionaryService(dictionaryService);
reader.setXPathHandler(handler);
reader.parse(queryText);
SolrPathQuery pathQuery = handler.getQuery();
pathQuery.setRepeats(withRepeats);
return new SolrCachingPathQuery(pathQuery);
}
示例8: createQNameQuery
import org.jaxen.saxpath.base.XPathReader; //导入方法依赖的package包/类
protected Query createQNameQuery(String queryText) throws SAXPathException
{
XPathReader reader = new XPathReader();
SolrXPathHandler handler = new SolrXPathHandler();
handler.setNamespacePrefixResolver(namespacePrefixResolver);
handler.setDictionaryService(dictionaryService);
reader.setXPathHandler(handler);
reader.parse("//" + queryText);
SolrPathQuery pathQuery = handler.getQuery();
return new SolrCachingPathQuery(pathQuery);
}
示例9: createPrimaryAssocQNameQuery
import org.jaxen.saxpath.base.XPathReader; //导入方法依赖的package包/类
protected Query createPrimaryAssocQNameQuery(String queryText) throws SAXPathException
{
XPathReader reader = new XPathReader();
SolrXPathHandler handler = new SolrXPathHandler();
handler.setNamespacePrefixResolver(namespacePrefixResolver);
handler.setDictionaryService(dictionaryService);
reader.setXPathHandler(handler);
reader.parse("//" + queryText);
SolrPathQuery pathQuery = handler.getQuery();
pathQuery.setPathField(FIELD_PRIMARYASSOCQNAME);
return new SolrCachingPathQuery(pathQuery);
}
示例10: createPrimaryAssocTypeQNameQuery
import org.jaxen.saxpath.base.XPathReader; //导入方法依赖的package包/类
protected Query createPrimaryAssocTypeQNameQuery(String queryText) throws SAXPathException
{
XPathReader reader = new XPathReader();
SolrXPathHandler handler = new SolrXPathHandler();
handler.setNamespacePrefixResolver(namespacePrefixResolver);
handler.setDictionaryService(dictionaryService);
reader.setXPathHandler(handler);
reader.parse("//" + queryText);
SolrPathQuery pathQuery = handler.getQuery();
pathQuery.setPathField(FIELD_PRIMARYASSOCTYPEQNAME);
return new SolrCachingPathQuery(pathQuery);
}
示例11: createAssocTypeQNameQuery
import org.jaxen.saxpath.base.XPathReader; //导入方法依赖的package包/类
protected Query createAssocTypeQNameQuery(String queryText) throws SAXPathException
{
XPathReader reader = new XPathReader();
SolrXPathHandler handler = new SolrXPathHandler();
handler.setNamespacePrefixResolver(namespacePrefixResolver);
handler.setDictionaryService(dictionaryService);
reader.setXPathHandler(handler);
reader.parse("//" + queryText);
SolrPathQuery pathQuery = handler.getQuery();
pathQuery.setPathField(FIELD_ASSOCTYPEQNAME);
return new SolrCachingPathQuery(pathQuery);
}
示例12: createPathQuery
import org.jaxen.saxpath.base.XPathReader; //导入方法依赖的package包/类
@Override
protected Query createPathQuery(String queryText, boolean withRepeats) throws SAXPathException
{
XPathReader reader = new XPathReader();
SolrXPathHandler handler = new SolrXPathHandler();
handler.setNamespacePrefixResolver(namespacePrefixResolver);
handler.setDictionaryService(dictionaryService);
reader.setXPathHandler(handler);
reader.parse(queryText);
SolrPathQuery pathQuery = handler.getQuery();
pathQuery.setRepeats(withRepeats);
return new SolrCachingPathQuery(pathQuery);
}
示例13: createQNameQuery
import org.jaxen.saxpath.base.XPathReader; //导入方法依赖的package包/类
protected Query createQNameQuery(String queryText) throws SAXPathException
{
XPathReader reader = new XPathReader();
SolrXPathHandler handler = new SolrXPathHandler();
handler.setNamespacePrefixResolver(namespacePrefixResolver);
handler.setDictionaryService(dictionaryService);
reader.setXPathHandler(handler);
reader.parse("//" + queryText);
SolrPathQuery pathQuery = handler.getQuery();
return new SolrCachingPathQuery(pathQuery);
}
示例14: createPrimaryAssocQNameQuery
import org.jaxen.saxpath.base.XPathReader; //导入方法依赖的package包/类
protected Query createPrimaryAssocQNameQuery(String queryText) throws SAXPathException
{
XPathReader reader = new XPathReader();
SolrXPathHandler handler = new SolrXPathHandler();
handler.setNamespacePrefixResolver(namespacePrefixResolver);
handler.setDictionaryService(dictionaryService);
reader.setXPathHandler(handler);
reader.parse("//" + queryText);
SolrPathQuery pathQuery = handler.getQuery();
pathQuery.setPathField(FIELD_PRIMARYASSOCQNAME);
return new SolrCachingPathQuery(pathQuery);
}
示例15: createPrimaryAssocTypeQNameQuery
import org.jaxen.saxpath.base.XPathReader; //导入方法依赖的package包/类
protected Query createPrimaryAssocTypeQNameQuery(String queryText) throws SAXPathException
{
XPathReader reader = new XPathReader();
SolrXPathHandler handler = new SolrXPathHandler();
handler.setNamespacePrefixResolver(namespacePrefixResolver);
handler.setDictionaryService(dictionaryService);
reader.setXPathHandler(handler);
reader.parse("//" + queryText);
SolrPathQuery pathQuery = handler.getQuery();
pathQuery.setPathField(FIELD_PRIMARYASSOCTYPEQNAME);
return new SolrCachingPathQuery(pathQuery);
}