当前位置: 首页>>代码示例>>Java>>正文


Java XPathReader类代码示例

本文整理汇总了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);
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:22,代码来源:SolrQueryParser.java

示例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;
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:23,代码来源:LuceneQueryParser.java

示例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);
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:21,代码来源:LuceneQueryParser.java

示例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;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:14,代码来源:IndexInfo.java

示例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]");
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:12,代码来源:DebugXPathHandler.java

示例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;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:20,代码来源:Search.java

示例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" );

}
 
开发者ID:jaxen-xpath,项目名称:jaxen,代码行数:15,代码来源:XPathReaderTest.java

示例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);
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:13,代码来源:Solr4QueryParser.java

示例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);
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:12,代码来源:Solr4QueryParser.java

示例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);
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:13,代码来源:Solr4QueryParser.java

示例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);
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:13,代码来源:Solr4QueryParser.java

示例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);
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:13,代码来源:Solr4QueryParser.java

示例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);
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:14,代码来源:SolrQueryParser.java

示例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);
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:12,代码来源:SolrQueryParser.java

示例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);
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:13,代码来源:SolrQueryParser.java


注:本文中的org.jaxen.saxpath.base.XPathReader类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。