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


Java Element.getName方法代碼示例

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


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

示例1: parse

import org.dom4j.Element; //導入方法依賴的package包/類
public Criterion parse(Element element) {
	NamedJunction junction=new NamedJunction();
	junction.setReferenceName(element.attributeValue("reference-name"));
	junction.setVariableCategory(element.attributeValue("var-category"));
	junction.setJunctionType(JunctionType.valueOf(element.attributeValue("junction-type")));
	List<NamedItem> items=new ArrayList<NamedItem>();
	junction.setItems(items);
	for(Object obj:element.elements()){
		if(obj==null || !(obj instanceof Element)){
			continue;
		}
		Element ele=(Element)obj;
		String name=ele.getName();
		if(!name.equals("named-criteria")){
			continue;
		}
		items.add(parseNamedItem(ele));
	}
	return junction;
}
 
開發者ID:youseries,項目名稱:urule,代碼行數:21,代碼來源:NamedJunctionParser.java

示例2: 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

示例3: parse

import org.dom4j.Element; //導入方法依賴的package包/類
public Other parse(Element element) {
	Other other=new Other();
	for(Object obj:element.elements()){
		if(obj==null || !(obj instanceof Element)){
			continue;
		}
		Element ele=(Element)obj;
		String name=ele.getName();
		for(ActionParser actionParser:actionParsers){
			if(actionParser.support(name)){
				other.addAction(actionParser.parse(ele));
				break;
			}
		}
	}
	return other;
}
 
開發者ID:youseries,項目名稱:urule,代碼行數:18,代碼來源:OtherParser.java

示例4: parse

import org.dom4j.Element; //導入方法依賴的package包/類
public Criterion parse(Element element) {
	Criteria criteria=new Criteria();
	Op op=Op.valueOf(element.attributeValue("op"));
	criteria.setOp(op);
	for(Object obj:element.elements()){
		if(obj==null || !(obj instanceof Element)){
			continue;
		}
		Element ele=(Element)obj;
		String name=ele.getName();
		if(name.equals("value")){
			criteria.setValue(valueParser.parse(ele));
		}else if(name.equals("left")){
			criteria.setLeft(leftParser.parse(ele));
		}
	}
	return criteria;
}
 
開發者ID:youseries,項目名稱:urule,代碼行數:19,代碼來源:CriteriaParser.java

示例5: parse

import org.dom4j.Element; //導入方法依賴的package包/類
@Override
public VariableTreeNode parse(Element element) {
	VariableTreeNode node=new VariableTreeNode();
	node.setNodeType(TreeNodeType.variable);
	List<ConditionTreeNode> conditionTreeNodes=new ArrayList<ConditionTreeNode>();
	for(Object obj:element.elements()){
		if(obj==null || !(obj instanceof Element)){
			continue;
		}
		Element ele=(Element)obj;
		String name=ele.getName();
		if(name.equals("left")){
			node.setLeft(leftParser.parse(ele));
		}else if(conditionTreeNodeParser.support(name)){
			ConditionTreeNode cn=conditionTreeNodeParser.parse(ele);
			cn.setParentNode(node);
			conditionTreeNodes.add(cn);
		}
	}
	if(conditionTreeNodes.size()>0){
		node.setConditionTreeNodes(conditionTreeNodes);
	}
	return node;
}
 
開發者ID:youseries,項目名稱:urule,代碼行數:25,代碼來源:VariableTreeNodeParser.java

示例6: getNodename

import org.dom4j.Element; //導入方法依賴的package包/類
private String getNodename(Element node, String parent) {
    String nodeName = "";
    if (!parent.equals(""))
        nodeName = parent + "." + node.getName();
    else
        nodeName = node.getName();
    return nodeName;
}
 
開發者ID:thomas-young-2013,項目名稱:wherehowsX,代碼行數:9,代碼來源:XMLFileAnalyzer.java

示例7: parser0

import org.dom4j.Element; //導入方法依賴的package包/類
public Definition parser0(String name, int version, Document processXML, boolean status) {
    Element root = processXML.getRootElement();
    String innerName = root.attributeValue("name");
    require(innerName != null, "attribute name in process is required");
    require(name.equals(innerName),
        String.format("name in process not equals given one\n" + "Inner: %s \n  Given: %s", innerName, name));

    String alias = root.attributeValue("alias");
    // 模板
    Definition definition = new Definition(name, "start", version, status, alias);

    // 解析xml
    for (Iterator i = root.elementIterator(); i.hasNext(); ) {
        Element tmp = (Element)i.next();
        StateLike state;
        try {
            state = StateFactory.newInstance(tmp.getName(), tmp);
        } catch (RuntimeException re) {
            logger.error(String.format("實例節點類型時候出錯,節點類型為:%s , 異常為:%s", tmp.getName(), re.toString()));
            throw re;
        } catch (Throwable e) {
            logger.error(String.format("實例節點類型時候出錯,節點類型為:%s , 異常為:", tmp.getName(), e.toString()));
            throw new UndeclaredThrowableException(e, "error happened when newInstance class:" + tmp.getName());
        }
        if (!state.isRunnable()) {
            definition.addExtNode(state);
        } else {
            definition.addState(state);
            if (!StringUtils.isBlank(tmp.getName()) && (tmp.getName()).contains("start")) {
                definition.setFirst(state.getStateName());
            }
        }
    }

    return definition;

}
 
開發者ID:alibaba,項目名稱:bulbasaur,代碼行數:38,代碼來源:Parser.java

示例8: parse

import org.dom4j.Element; //導入方法依賴的package包/類
@Override
public StateLike parse(Element elem) {
    super.parse(elem);
    if (elem.attributeValue(REPEATLIST_TAG) != null) {
        repeatList = elem.attributeValue(REPEATLIST_TAG);
    }
    if (elem.attributeValue(IGNOREWEEKEND_TAG) != null) {
        ignoreWeekend = Boolean.valueOf(elem.attributeValue(IGNOREWEEKEND_TAG));
    }

    List<Element> invokesPaths = elem.selectNodes(INVOKES_TAG);
    // 拿孩子節點
    for (Element node : invokesPaths) {
        for (Iterator i = node.elementIterator(); i.hasNext(); ) {
            Element child = (Element)i.next();
            try {
                invokes.add(InvokableFactory.newInstance(child.getName(), child));
            } catch (RuntimeException re) {
                logger.error(String.format("實例Invokable類型時候出錯,類型為: %s , 異常為: %s", child.getName(), re.toString()));
                throw re;
            } catch (Throwable e) {
                logger.error(String.format("實例Invokable類型時候出錯,類型為: %s , 異常為: %s", child.getName(), e.toString()));
                throw new UndeclaredThrowableException(e,
                    "error happened when newInstance Invokable class:" + child.getName());
            }

        }
    }
    return this;
}
 
開發者ID:alibaba,項目名稱:bulbasaur,代碼行數:31,代碼來源:State.java

示例9: 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

示例10: orderSequenceElements

import org.dom4j.Element; //導入方法依賴的package包/類
/**
 *  Put sequence elements in the order specified by the sequence compositor.
 *
 * @param  parent  NOT YET DOCUMENTED
 */
public void orderSequenceElements(Element parent) {
	String xpath = parent.getPath();
	List order = schemaHelper.getChildrenOrder(xpath);

	// just as a safeguard, don't reorder if there is only one child
	// for the schemaNode, since parent is probably a repeating element
	// and reordering would wipe out all but one child
	if (order.size() < 2)
		return;

	// map element name to a list of elements to accomodate repeating elements
	Map elementMap = new HashMap();
	List elements = parent.elements();
	for (int i = elements.size() - 1; i > -1; i--) {
		Element e = (Element) elements.get(i);
		String tagName = e.getName();
		List items = (List) elementMap.get(tagName);
		if (items == null)
			items = new ArrayList();
		items.add(0, e.detach()); // add to beginning to maintain doc ordering
		elementMap.put(tagName, items);
	}

	for (Iterator i = order.iterator(); i.hasNext(); ) {
		String name = (String) i.next();
		elements = (List) elementMap.get(name);
		if (elements != null) {
			for (Iterator ii = elements.iterator(); ii.hasNext(); ) {
				parent.add((Element) ii.next());
			}
		}
	}
}
 
開發者ID:NCAR,項目名稱:joai-project,代碼行數:39,代碼來源:DocMap.java

示例11: pruneRepeatingFields

import org.dom4j.Element; //導入方法依賴的package包/類
/**
 *  Removes empty elements of repeating fields.<p>
 *
 *  DISABLED 5/11/04 - the repository will contain non-valid elements, so we
 *  don't worry so much about getting rid of the empty elements (many of which
 *  will be invalid due to the "stringTextType" convention) Removes empty child
 *  elements from each repeating field in the toPrune list. Children are pruned
 *  if they are empty and their occurance attribute allows them to be deleted.
 */
protected void pruneRepeatingFields() {
	prtln ("\nPruneRepeatingFields()");
	List toPruneList = sef.getRepeatingFieldsToPrune();

	// for each repeating field on the toPrune list
	for (Iterator p = toPruneList.iterator(); p.hasNext(); ) {
		String parentPath = (String) p.next();
		prtln ("\t parent: " + parentPath);
		Element parent = (Element) docMap.selectSingleNode(parentPath);
		if (parent == null) {
			prtln("pruneRepeatingFields(): Element not found for " + parentPath);
			continue;
		}
		List children = parent.elements();
		SchemaNode schemaNode = schemaHelper.getSchemaNode(XPathUtils.normalizeXPath(parentPath));
		if (schemaNode == null) {
			prtln("pruneRepeatingFields() couldn't find SchemaNode");
			continue;
		}

		for (int i = children.size() - 1; i > -1; i--) {
			Element child = (Element) children.get(i);
			String childName = child.getName();
			prtln ("\t     childName: " + childName);
			if (!Dom4jUtils.isEmpty(child)) {
				continue;
			}
			if (parent.elements().size() >= schemaNode.getMinOccurs()) {
				String childPath = child.getPath();
				parent.remove(child);
			}
		}
		parent.setText("");
	}
	sef.clearRepeatingFieldsToPrune();
}
 
開發者ID:NCAR,項目名稱:joai-project,代碼行數:46,代碼來源:SchemEditValidator.java

示例12: parseSecurity

import org.dom4j.Element; //導入方法依賴的package包/類
private void parseSecurity(Element secNode) {
	final String nodeContextId = secNode.attributeValue( "context" );

	final String explicitContextId = getProperty( AvailableSettings.JACC_CONTEXT_ID );
	if ( explicitContextId == null ) {
		setProperty( AvailableSettings.JACC_CONTEXT_ID, nodeContextId );
		LOG.jaccContextId( nodeContextId );
	}
	else {
		// if they dont match, throw an error
		if ( ! nodeContextId.equals( explicitContextId ) ) {
			throw new HibernateException( "Non-matching JACC context ids" );
		}
	}
	jaccPermissionDeclarations = new JaccPermissionDeclarations( nodeContextId );

	Iterator grantElements = secNode.elementIterator();
	while ( grantElements.hasNext() ) {
		final Element grantElement = (Element) grantElements.next();
		final String elementName = grantElement.getName();
		if ( "grant".equals( elementName ) ) {
			jaccPermissionDeclarations.addPermissionDeclaration(
					new GrantedPermission(
							grantElement.attributeValue( "role" ),
							grantElement.attributeValue( "entity-name" ),
							grantElement.attributeValue( "actions" )
					)
			);
		}
	}
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:32,代碼來源:Configuration.java

示例13: parse

import org.dom4j.Element; //導入方法依賴的package包/類
public FlowDefinition parse(Element element) {
	FlowDefinition flow=new FlowDefinition();
	flow.setId(element.attributeValue("id"));
	String debug=element.attributeValue("debug");
	if(StringUtils.isNotBlank(debug)){
		flow.setDebug(Boolean.valueOf(debug));
	}
	List<FlowNode> nodes=new ArrayList<FlowNode>();
	for(Object obj:element.elements()){
		if(obj==null || !(obj instanceof Element)){
			continue;
		}
		Element ele=(Element)obj;
		String name=ele.getName();
		if(name.equals("import-variable-library")){
			flow.addLibrary(buildLibrary(ele, LibraryType.Variable));
		}else if(name.equals("import-constant-library")){
			flow.addLibrary(buildLibrary(ele, LibraryType.Constant));
		}else if(name.equals("import-action-library")){
			flow.addLibrary(buildLibrary(ele, LibraryType.Action));
		}else if(name.equals("import-parameter-library")){
			flow.addLibrary(buildLibrary(ele, LibraryType.Parameter));
		}else{
			for(FlowNodeParser parser:nodeParsers){
				if(parser.support(ele.getName())){
					nodes.add((FlowNode)parser.parse(ele));
					break;
				}
			}
		}
	}
	flow.setNodes(nodes);
	flow.buildConnectionToNode();
	return flow;
}
 
開發者ID:youseries,項目名稱:urule,代碼行數:36,代碼來源:FlowDefinitionParser.java

示例14: contain

import org.dom4j.Element; //導入方法依賴的package包/類
public boolean contain(String path, String xml) {
	try{
		Document doc=DocumentHelper.parseText(xml);
		Element element=doc.getRootElement();
		for(Object obj:element.elements()){
			if(!(obj instanceof Element)){
				continue;
			}
			Element ele=(Element)obj;
			String name=ele.getName();
			boolean match=false;
			if(name.equals("import-variable-library")){
				match=true;
			}else if(name.equals("import-constant-library")){
				match=true;
			}else if(name.equals("import-action-library")){
				match=true;
			}else if(name.equals("import-parameter-library")){
				match=true;
			}
			if(!match){
				continue;
			}
			String filePath=ele.attributeValue("path");
			if(filePath.endsWith(path)){
				return true;
			}
		}
		return false;
	}catch(Exception ex){
		throw new RuleException(ex);
	}
}
 
開發者ID:youseries,項目名稱:urule,代碼行數:34,代碼來源:DecisionTableReferenceUpdater.java

示例15: update

import org.dom4j.Element; //導入方法依賴的package包/類
public String update(String oldPath, String newPath, String xml) {
	try{
		boolean modify=false;
		Document doc=DocumentHelper.parseText(xml);
		Element element=doc.getRootElement();
		for(Object obj:element.elements()){
			if(!(obj instanceof Element)){
				continue;
			}
			Element ele=(Element)obj;
			String name=ele.getName();
			boolean match=false;
			if(name.equals("import-variable-library")){
				match=true;
			}else if(name.equals("import-constant-library")){
				match=true;
			}else if(name.equals("import-action-library")){
				match=true;
			}else if(name.equals("import-parameter-library")){
				match=true;
			}
			if(!match){
				continue;
			}
			String path=ele.attributeValue("path");
			if(path.endsWith(oldPath)){
				ele.addAttribute("path", newPath);
				modify=true;
			}
		}
		if(modify){
			return xmlToString(doc);
		}
		return null;
	}catch(Exception ex){
		throw new RuleException(ex);
	}
}
 
開發者ID:youseries,項目名稱:urule,代碼行數:39,代碼來源:DecisionTableReferenceUpdater.java


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