当前位置: 首页>>代码示例>>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;未经允许,请勿转载。