本文整理汇总了Java中org.jaxen.saxpath.base.XPathReader类的典型用法代码示例。如果您正苦于以下问题:Java XPathReader类的具体用法?Java XPathReader怎么用?Java XPathReader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
XPathReader类属于org.jaxen.saxpath.base包,在下文中一共展示了XPathReader类的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: setUp
import org.jaxen.saxpath.base.XPathReader; //导入依赖的package包/类
public void setUp() throws ParserConfigurationException, SAXException, IOException
{
this.reader = new XPathReader();
this.actual = new ConformanceXPathHandler();
this.reader.setXPathHandler( this.actual );
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true);
DocumentBuilder builder = factory.newDocumentBuilder();
doc = builder.parse( "xml/basic.xml" );
}
示例8: 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);
}
示例9: 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);
}
示例10: 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);
}
示例11: 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);
}
示例12: 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);
}
示例13: 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);
}
示例14: 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);
}
示例15: 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);
}