當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。