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


Java Element.elements方法代码示例

本文整理汇总了Java中org.dom4j.Element.elements方法的典型用法代码示例。如果您正苦于以下问题:Java Element.elements方法的具体用法?Java Element.elements怎么用?Java Element.elements使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.dom4j.Element的用法示例。


在下文中一共展示了Element.elements方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: parseActions

import org.dom4j.Element; //导入方法依赖的package包/类
public List<Action> parseActions(Element element){
	List<Action> actions=new ArrayList<Action>();
	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)){
				actions.add(actionParser.parse(ele));
				break;
			}
		}
	}
	return actions;
}
 
开发者ID:youseries,项目名称:urule,代码行数:18,代码来源:RhsParser.java

示例2: parseDatasetNode

import org.dom4j.Element; //导入方法依赖的package包/类
/** parse a dataset node from xml */
private static OozieDatasetNode parseDatasetNode(Element xml_node) {
	List<Element> childNodes = xml_node.elements();
	OozieDatasetNode node = new OozieDatasetNode();

	for( Element child : childNodes){
		String value = child.getText();
		String name = child.getName();

		if ("id".equals(name))
			node.setId(value);
		else if ("moduleId".equals(name))
			node.setModuleId(value);
		else if ("x".equals(name))
			node.setX((int) Float.parseFloat(value));
		else if ("y".equals(name))
			node.setY((int) Float.parseFloat(value));
		else if ("file".equals(name))
			node.setFile(value);
	}

	return node;
}
 
开发者ID:ICT-BDA,项目名称:EasyML,代码行数:24,代码来源:OozieGraphXMLParser.java

示例3: parse

import org.dom4j.Element; //导入方法依赖的package包/类
@Override
public CheckboxInputComponent parse(Element element) {
	CheckboxInputComponent checkbox=new CheckboxInputComponent();
	checkbox.setBindParameter(element.attributeValue("bind-parameter"));
	checkbox.setOptionsInline(Boolean.valueOf(element.attributeValue("options-inline")));
	checkbox.setLabel(element.attributeValue("label"));
	checkbox.setType(element.attributeValue("type"));
	checkbox.setLabelPosition(LabelPosition.valueOf(element.attributeValue("label-position")));
	List<Option> options=new ArrayList<Option>();
	for(Object obj:element.elements()){
		if(obj==null || !(obj instanceof Element)){
			continue;
		}
		Element ele=(Element)obj;
		if(!ele.getName().equals("option")){
			continue;
		}
		Option option=new Option();
		options.add(option);
		option.setLabel(ele.attributeValue("label"));
		option.setValue(ele.attributeValue("value"));
	}
	checkbox.setOptions(options);
	return checkbox;
}
 
开发者ID:youseries,项目名称:ureport,代码行数:26,代码来源:CheckboxParser.java

示例4: element2Map

import org.dom4j.Element; //导入方法依赖的package包/类
/**
 * Element to map
 * @param e
 * @param map
 */
public static void element2Map(Element e, Map<String, Object> map) {
    List<Object> list = e.elements();
    if (e.attributeCount() > 0) {
        for (Object attri : e.attributes()) {
            Attribute at = (Attribute)attri;
            map.put(at.getName(), at.getValue());
        }
    }
    if (list.size() < 1 && DataUtil.isEmpty(e.getText())) {
        return;
    } else if (list.size() < 1 && !DataUtil.isEmpty(e.getText())) {
        map.put("text", e.getText());
    }
    for (Object aList : list) {
        Element iter = (Element)aList;
        Map<String, Object> cMap = new HashMap<String, Object>();
        element2Map(iter, cMap);
        map.put(iter.getName(), cMap);
    }
}
 
开发者ID:iBase4J,项目名称:iBase4J-Common,代码行数:26,代码来源:XmlUtil.java

示例5: parseParameters

import org.dom4j.Element; //导入方法依赖的package包/类
private List<Parameter> parseParameters(Element element){
	List<Parameter> parameters=new ArrayList<Parameter>();
	for(Object obj:element.elements()){
		if(obj==null || !(obj instanceof Element)){
			continue;
		}
		Element ele=(Element)obj;
		if(!ele.getName().equals("parameter")){
			continue;
		}
		Parameter param=new Parameter();
		param.setName(ele.attributeValue("name"));
		param.setDefaultValue(ele.attributeValue("default-value"));
		param.setType(DataType.valueOf(ele.attributeValue("type")));
		parameters.add(param);
	}
	return parameters;
}
 
开发者ID:youseries,项目名称:ureport,代码行数:19,代码来源:DatasourceParser.java

示例6: getKeysInXML

import org.dom4j.Element; //导入方法依赖的package包/类
/**
 * 从指定的xml文件返回在zookeeper中的key集合
 * 
 * @param fromDoc
 *            源xml文件
 * @param znodePath
 *            znode路径前缀
 * @return
 */
public static Set<String> getKeysInXML(Document fromDoc, String znodePath) {
	Set<String> xmlKeys = new HashSet<>();

	Element rootEle = fromDoc.getRootElement();
	List<Element> paramsList = rootEle.elements("params");
	for (Element paramEle : paramsList) {
		String paramName = paramEle.attributeValue("name");
		List<Element> paramList = paramEle.elements("param");
		for (Element param : paramList) {
			String paramKey = param.attributeValue("name");
			xmlKeys.add(znodePath + "/" + paramName + "/" + paramKey);
		}
	}
	return xmlKeys;
}
 
开发者ID:jtjsir,项目名称:zookeeper-test-demo,代码行数:25,代码来源:ConfigUtil.java

示例7: addEntityListenerClasses

import org.dom4j.Element; //导入方法依赖的package包/类
private List<String> addEntityListenerClasses(Element element, String packageName, List<String> addedClasses) {
	List<String> localAddedClasses = new ArrayList<String>();
	Element listeners = element.element( "entity-listeners" );
	if ( listeners != null ) {
		@SuppressWarnings( "unchecked" )
		List<Element> elements = listeners.elements( "entity-listener" );
		for (Element listener : elements) {
			String listenerClassName = buildSafeClassName( listener.attributeValue( "class" ), packageName );
			if ( classOverriding.containsKey( listenerClassName ) ) {
				//maybe switch it to warn?
				if ( "entity-listener".equals( classOverriding.get( listenerClassName ).getName() ) ) {
					LOG.duplicateListener( listenerClassName );
					continue;
				}
				throw new IllegalStateException("Duplicate XML entry for " + listenerClassName);
			}
			localAddedClasses.add( listenerClassName );
			classOverriding.put( listenerClassName, listener );
		}
	}
	LOG.debugf( "Adding XML overriding information for listeners: %s", localAddedClasses );
	addedClasses.addAll( localAddedClasses );
	return localAddedClasses;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:25,代码来源:XMLContext.java

示例8: parserVarList

import org.dom4j.Element; //导入方法依赖的package包/类
/**
 * 解析list类型全局变量
 * @param node vars节点
 * @return 返回所有list类型变量
 */
public static Map<String,Object> parserVarList(Element node){
    Map<String,Object> vars = new HashMap<String, Object>();
    if(node!=null){
        List<Element> childs = node.elements("list");
        if(childs!=null&&childs.size()>0){
            for(Element list : childs){
                List<Element> itemsE = list.elements();
                List<String> itemsContainer = new ArrayList<String>();
                for(Element item : itemsE){
                    itemsContainer.add(item.getText());
                }
                vars.put(list.attributeValue("name"),itemsContainer);
            }
        }
    }
    return vars;
}
 
开发者ID:javahaohao,项目名称:gen_code,代码行数:23,代码来源:ConfigParser.java

示例9: parseConnections

import org.dom4j.Element; //导入方法依赖的package包/类
protected List<Connection> parseConnections(Element element){
	List<Connection> connections=new ArrayList<Connection>();
	for(Object obj:element.elements()){
		if(obj==null || !(obj instanceof Element)){
			continue;
		}
		Element ele=(Element)obj;
		if(!ele.getName().equals("connection")){
			continue;
		}
		connections.add(buildConnection(ele));
	}
	return connections;
}
 
开发者ID:youseries,项目名称:urule,代码行数:15,代码来源:FlowNodeParser.java

示例10: bindNamedAttributeNodes

import org.dom4j.Element; //导入方法依赖的package包/类
private static void bindNamedAttributeNodes(Element subElement, AnnotationDescriptor ann) {
	List<Element> namedAttributeNodes = subElement.elements("named-attribute-node");
	List<NamedAttributeNode> annNamedAttributeNodes = new ArrayList<NamedAttributeNode>(  );
	for(Element namedAttributeNode : namedAttributeNodes){
		AnnotationDescriptor annNamedAttributeNode = new AnnotationDescriptor( NamedAttributeNode.class );
		copyStringAttribute( annNamedAttributeNode, namedAttributeNode, "value", true );
		copyStringAttribute( annNamedAttributeNode, namedAttributeNode, "subgraph", false );
		copyStringAttribute( annNamedAttributeNode, namedAttributeNode, "key-subgraph", false );
		annNamedAttributeNodes.add( (NamedAttributeNode) AnnotationFactory.create( annNamedAttributeNode ) );
	}
	ann.setValue( "attributeNodes", annNamedAttributeNodes.toArray( new NamedAttributeNode[annNamedAttributeNodes.size()] ) );
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:13,代码来源:JPAOverriddenAnnotationReader.java

示例11: parse

import org.dom4j.Element; //导入方法依赖的package包/类
public SpringBean parse(Element element) {
	SpringBean bean=new SpringBean();
	bean.setId(element.attributeValue("id"));
	for(Object obj:element.elements()){
		if(obj==null || !(obj instanceof Element)){
			continue;
		}
		Element ele=(Element)obj;
		if(ele.getName().equals("method")){
			Method method=parseMethod(ele);
			bean.addMethod(method);
		}
	}
	return bean;
}
 
开发者ID:youseries,项目名称:urule,代码行数:16,代码来源:SpringBeanParser.java

示例12: initializeTimePatternData

import org.dom4j.Element; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private void initializeTimePatternData(Element rootElement) throws Exception {
       loadExistingTimePatterns(session.getUniqueId());

       Element timePatternsElement = rootElement.element(PointInTimeDataExport.sTimePatternsElementName);
       for(Element timePatternElement : (List<Element>) timePatternsElement.elements()){
       	elementTimePattern(timePatternElement);
       }
	
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:11,代码来源:PointInTimeDataImport.java

示例13: parse

import org.dom4j.Element; //导入方法依赖的package包/类
@Override
public Value parse(Element element) {
	SlashValue value=new SlashValue();
	List<Slash> slashes=new ArrayList<Slash>();
	value.setSlashes(slashes);
	for(Object obj:element.elements()){
		if(obj==null || !(obj instanceof Element)){
			continue;
		}
		Element ele=(Element)obj;
		if(ele.getName().equals("slash")){
			Slash slash=new Slash();
			slashes.add(slash);
			slash.setDegree(Integer.valueOf(ele.attributeValue("degree")));
			slash.setX(Integer.valueOf(ele.attributeValue("x")));
			slash.setY(Integer.valueOf(ele.attributeValue("y")));
			slash.setText(ele.attributeValue("text"));				
		}else if(ele.getName().equals("base64-data")){
			String prefix="data:image/png;base64,";
			String base64Data=ele.getText();
			if(base64Data.startsWith(prefix)){
				base64Data=base64Data.substring(prefix.length(),base64Data.length());
			}
			value.setBase64Data(base64Data);
		}
	}
	return value;
}
 
开发者ID:youseries,项目名称:ureport,代码行数:29,代码来源:SlashValueParser.java

示例14: setUp

import org.dom4j.Element; //导入方法依赖的package包/类
@Before
    public void setUp() throws Exception {
        InputStream is = new FileInputStream(new File(xmlFile));
        if (is == null) {
            throw new FileNotFoundException("Excel的描述文件 : " + xmlFile + " 未找到.");
        }
        SAXReader saxReader = new SAXReader();
        Document document = saxReader.read(is);
        // 根节点
        Element root = document.getRootElement();
        // 一次导入
        onceList = root.elements("onceImport");
        // 重复导入
        List repeatList = root.elements("repeatImport");

        // 校验器的定义
        List validators = root.elements("validators");
        // 单元格校验
        List cellValidators = root.elements("cell-validators");

        excelStruct = new ExcelStruct();

        // 读取校验器配置
//        parseValidatorConfig(excelStruct, validators, cellValidators);

//        simpleParseOnceImport(excelStruct, onceList);

        is.close();

    }
 
开发者ID:ssqfzc,项目名称:ExcelUtils,代码行数:31,代码来源:ParseXMLUtilTest.java

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


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