當前位置: 首頁>>代碼示例>>Java>>正文


Java Element.getUniquePath方法代碼示例

本文整理匯總了Java中org.dom4j.Element.getUniquePath方法的典型用法代碼示例。如果您正苦於以下問題:Java Element.getUniquePath方法的具體用法?Java Element.getUniquePath怎麽用?Java Element.getUniquePath使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.dom4j.Element的用法示例。


在下文中一共展示了Element.getUniquePath方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getLuceneQuery

import org.dom4j.Element; //導入方法依賴的package包/類
/**
 *  Gets the Lucene Query representation for the given XML Query starting at the Query element.
 *
 * @param  queryElement   A dom4j representation of the Query element
 * @param  queryParser    QueryParser used to parse Lucene syntax based queries and tokenize the text
 * @return                The Lucene Query object representation of this XML Query
 * @exception  Exception  If error
 */
public static Query getLuceneQuery(Element queryElement, QueryParser queryParser) throws Exception {
	// Check if requested to exclude from results, which is an error if not within a boolean clause
	String excludeOrRequire = queryElement.attributeValue("excludeOrRequire");
	if (excludeOrRequire != null)
		throw new Exception("Error parsing document: attribute excludeOrRequire may only be used when the query is enclosed in an encompassing <booleanQuery>. Error found at: " + queryElement.getUniquePath());

	if (queryElement.getName().equals("booleanQuery"))
		return makeBooleanQuery(queryElement, queryParser);
	else if (queryElement.getName().equals("textQuery"))
		return makeLuceneQuery(queryElement, queryParser);
	else if (queryElement.getName().equals("luceneQuery"))
		return makeLuceneQuery(queryElement, queryParser);
	else
		throw new Exception("Error parsing document: invalid element name '<" + queryElement.getName() + ">' at " + queryElement.getUniquePath());
}
 
開發者ID:NCAR,項目名稱:joai-project,代碼行數:24,代碼來源:XMLQueryParser.java

示例2: read

import org.dom4j.Element; //導入方法依賴的package包/類
private static void read(Element e) {
    String result = "";
    if( !"".equals(targetPath) ){
        return ;
    }
    if (e.nodeCount() > 0) {
        Iterator<Element> it = e.elementIterator();
        while (it.hasNext()) {
            Element ele = it.next();
            if( "CSVDataSet".equals(ele.getName()) ){
                /*if("".equals(targetPath)){ //查到的第一個 CSVDataSet 保存到參數中,
                    targetPath = ele.getUniquePath();
                }*/
                targetPath = ele.getUniquePath();
            }
            read(ele);
        }
    }

}
 
開發者ID:wang153723482,項目名稱:testing_platform,代碼行數:21,代碼來源:Tools.java

示例3: GenericType

import org.dom4j.Element; //導入方法依賴的package包/類
/**
 *  Constructor - accounting for location and schemaReader.
 *
 * @param  element       NOT YET DOCUMENTED
 * @param  location      NOT YET DOCUMENTED
 * @param  namespace     NOT YET DOCUMENTED
 * @param  schemaReader  NOT YET DOCUMENTED
 */
public GenericType(Element element, String location, Namespace namespace, SchemaReader schemaReader) {
	this.xsdPrefix = schemaReader.getNamespaces().getSchemaNamespace().getPrefix();
	this.location = location;
	this.name = element.attributeValue("name");
	this.element = element;
	this.namespace = namespace;
	this.schemaReader = schemaReader;
	this.path = element.getUniquePath();
	this.type = element.getName();
	if (schemaDocAware)
		extractDocumentation();
	else
		filterChildren(xsdPrefix + ":annotation");
}
 
開發者ID:NCAR,項目名稱:joai-project,代碼行數:23,代碼來源:GenericType.java

示例4: makeBooleanQuery

import org.dom4j.Element; //導入方法依賴的package包/類
private static Query makeBooleanQuery(Element booleanQueryElement, QueryParser queryParser) throws Exception {
	String operator = booleanQueryElement.valueOf("@type");

	boolean isRequired = false;
	boolean isProhibited = false;

	if (operator == null)
		throw new Exception("Error parsing document: element <booleanQuery> must contain an attribite named 'type' that contains the value 'AND' or 'OR'. Error found at " + booleanQueryElement.getUniquePath());
	else if (operator.equalsIgnoreCase("OR"))
		isRequired = false;
	else if (operator.equalsIgnoreCase("AND"))
		isRequired = true;
	else
		throw new Exception("Error parsing document: element <booleanQuery> must contain an attribite named 'type' that contains the value 'AND' or 'OR' but value '" + operator + "' was found. Error found at " + booleanQueryElement.getUniquePath());

	BooleanQuery booleanQuery = new BooleanQuery();

	// iterate through child elements of booleanClause
	Query query = null;
	for (Iterator i = booleanQueryElement.elementIterator(); i.hasNext(); ) {
		Element element = (Element) i.next();

		// Exclude from results or require (overrides previous boolean designation)?
		String excludeOrRequire = element.attributeValue("excludeOrRequire");
		if (excludeOrRequire != null) {
			excludeOrRequire = excludeOrRequire.trim();
			if (excludeOrRequire.equalsIgnoreCase("exclude")) {
				isRequired = false;
				isProhibited = true;
			}
			else if (excludeOrRequire.equalsIgnoreCase("require")) {
				isRequired = true;
				isProhibited = false;
			}
			else if (excludeOrRequire.equalsIgnoreCase("neither")) {
				isRequired = false;
				isProhibited = false;
			}
			else {
				throw new Exception("Error parsing document: the value of attribute excludeOrRequire must be one of 'exclude', 'require' or 'neither' but '"
					 + excludeOrRequire + "' was found at " + booleanQueryElement.getUniquePath());
			}
		}

		if (element.getName().equals("booleanQuery")) {
			query = makeBooleanQuery(element, queryParser);
			if (query != null) {
				if (isRequired && !isProhibited)
					booleanQuery.add(query, BooleanClause.Occur.MUST);
				else if (!isRequired && isProhibited)
					booleanQuery.add(query, BooleanClause.Occur.MUST_NOT);
				else
					booleanQuery.add(query, BooleanClause.Occur.SHOULD);
			}
		}
		else {
			query = makeLuceneQuery(element, queryParser);
			if (query != null) {
				if (isRequired && !isProhibited)
					booleanQuery.add(query, BooleanClause.Occur.MUST);
				else if (!isRequired && isProhibited)
					booleanQuery.add(query, BooleanClause.Occur.MUST_NOT);
				else
					booleanQuery.add(query, BooleanClause.Occur.SHOULD);
			}
		}
	}

	return applyBoost(booleanQueryElement, booleanQuery);
}
 
開發者ID:NCAR,項目名稱:joai-project,代碼行數:71,代碼來源:XMLQueryParser.java

示例5: getUniquePath

import org.dom4j.Element; //導入方法依賴的package包/類
public String getUniquePath(Element element) {
	return element.getUniquePath( element );
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:4,代碼來源:ElementWrapper.java


注:本文中的org.dom4j.Element.getUniquePath方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。