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


Java Element.elementIterator方法代码示例

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


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

示例1: parseXml2Map

import org.dom4j.Element; //导入方法依赖的package包/类
/**
 * 解析XML并将其节点元素压入Dto返回(基于节点值形式的XML格式)
 * 
 * @param pStrXml 待解析的XML字符串
 * @return outDto 返回Dto
 */
public static final Map parseXml2Map(String pStrXml) {
    Map map = new HashMap();
    String strTitle = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
    Document document = null;
    try {
        if (pStrXml.indexOf("<?xml") < 0) pStrXml = strTitle + pStrXml;
        document = DocumentHelper.parseText(pStrXml);

    } catch (DocumentException e) {
        logger.error("==开发人员请注意:==\n将XML格式的字符串转换为XML DOM对象时发生错误啦!" + "\n详细错误信息如下:", e);
    }
    // 获取根节点
    Element elNode = document.getRootElement();
    // 遍历节点属性值将其压入Dto
    for (Iterator it = elNode.elementIterator(); it.hasNext();) {
        Element leaf = (Element)it.next();
        map.put(leaf.getName().toLowerCase(), leaf.getData());
    }
    return map;
}
 
开发者ID:iBase4J,项目名称:iBase4J-Common,代码行数:27,代码来源:XmlUtil.java

示例2: parseXml2Map

import org.dom4j.Element; //导入方法依赖的package包/类
/**
 * 解析XML并将其节点元素压入Dto返回(基于节点值形式的XML格式)
 * 
 * @param pStrXml 待解析的XML字符串
 * @param pXPath 节点路径(例如:"//paralist/row" 则表示根节点paralist下的row节点的xPath路径)
 * @return outDto 返回Dto
 */
public static final Map parseXml2Map(String pStrXml, String pXPath) {
	Map map = new HashMap();
	String strTitle = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
	Document document = null;
	try {
		if (pStrXml.indexOf("<?xml") < 0)
			pStrXml = strTitle + pStrXml;
		document = DocumentHelper.parseText(pStrXml);
	} catch (DocumentException e) {
		log.error("==开发人员请注意:==\n将XML格式的字符串转换为XML DOM对象时发生错误啦!" + "\n详细错误信息如下:", e);
	}
	// 获取根节点
	Element elNode = document.getRootElement();
	// 遍历节点属性值将其压入Dto
	for (Iterator it = elNode.elementIterator(); it.hasNext();) {
		Element leaf = (Element) it.next();
		map.put(leaf.getName().toLowerCase(), leaf.getData());
	}
	return map;
}
 
开发者ID:tb544731152,项目名称:iBase4J,代码行数:28,代码来源:XmlUtil.java

示例3: findClassNames

import org.dom4j.Element; //导入方法依赖的package包/类
private void findClassNames(String defaultPackage, Element startNode, Set<String> names) {
	// if we have some extends we need to check if those classes possibly could be inside the
	// same hbm.xml file...
	Iterator[] classes = new Iterator[4];
	classes[0] = startNode.elementIterator( "class" );
	classes[1] = startNode.elementIterator( "subclass" );
	classes[2] = startNode.elementIterator( "joined-subclass" );
	classes[3] = startNode.elementIterator( "union-subclass" );

	Iterator classIterator = new JoinedIterator( classes );
	while ( classIterator.hasNext() ) {
		Element element = ( Element ) classIterator.next();
		String entityName = element.attributeValue( "entity-name" );
		if ( entityName == null ) {
			entityName = getClassName( element.attribute( "name" ), defaultPackage );
		}
		names.add( entityName );
		findClassNames( defaultPackage, element, names );
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:21,代码来源:Configuration.java

示例4: getBankBranchLabel

import org.dom4j.Element; //导入方法依赖的package包/类
private void getBankBranchLabel(Document document) {
	Element element = null;
	Element roote = document.getRootElement();
	for (@SuppressWarnings("unchecked")
	Iterator<Element> it = roote.elementIterator(bNode[0]); it.hasNext();) {
		element = it.next();
		IndexModel index = new IndexModel();
		index.setId(element.attributeValue(bNode[1]));
		index.setIndexStr(element.attributeValue(bNode[4]));
		index.setIndexBody(element.attributeValue(bNode[4]));
		index.setBankCode(element.attributeValue(bNode[2]));
		index.setCityCode(element.attributeValue(bNode[3]));
		branchList.add(index);
		
	}
}
 
开发者ID:yi-jun,项目名称:aaden-pay,代码行数:17,代码来源:LianlianBranchTest.java

示例5: elementLocation

import org.dom4j.Element; //导入方法依赖的package包/类
private Vector<NonUniversityLocation> elementLocation(Element element, Class_ c) throws Exception {
	Vector<NonUniversityLocation> locations = new Vector<NonUniversityLocation>();
	String elementName = "location";
       if(element.element(elementName) != null){
       	for (Iterator<?> it = element.elementIterator(elementName); it.hasNext();){
			Element roomElement = (Element) it.next();
			
			String name = getRequiredStringAttribute(roomElement, "name", elementName);
			String id = getOptionalStringAttribute(roomElement, "id");
			
			NonUniversityLocation location = findNonUniversityLocation(id, name, c.getManagingDept());
			if (location != null){
				locations.add(location);
			} else {
				addMissingLocation(name + " - " + c.getSchedulingSubpart().getControllingCourseOffering().getSubjectArea().getSubjectAreaAbbreviation());
			}
		}
       }
       if (locations.isEmpty()){
       	return(null);
       } else {
       	return(locations);
       }
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:25,代码来源:BaseCourseOfferingImport.java

示例6: getPageList

import org.dom4j.Element; //导入方法依赖的package包/类
/**
 *  Gets the pageList attribute of the FrameworkConfigReader object
 *
 * @return    The pageList value
 */
public PageList getPageList() {
	if (this.pageList == null) {
		pageList = new PageList();
		Node editorPagesNode = getNode("/frameworkConfigRecord/editorInfo/editorPages");
		if (editorPagesNode != null) {
			Element fieldInfoElement = (Element) editorPagesNode;
			for (Iterator i = fieldInfoElement.elementIterator(); i.hasNext(); ) {
				Element editorPage = (Element) i.next();
				String pageLabel = editorPage.attributeValue("pageLabel");
				String elementName = editorPage.getText();
				pageList.addPage(elementName, pageLabel);
			}
		}
		String firstPage = getNodeText("/frameworkConfigRecord/editorInfo/firstPage");
		if (firstPage == null || firstPage.trim().length() == 0)
			firstPage = this.getRootElementName();
		pageList.setFirstPage(firstPage);
		pageList.setHomePage(getXmlFormat() + ".index");
	}
	return pageList;
}
 
开发者ID:NCAR,项目名称:joai-project,代码行数:27,代码来源:FrameworkConfigReader.java

示例7: elementRelatedCourses

import org.dom4j.Element; //导入方法依赖的package包/类
private void elementRelatedCourses(Element element, CourseEvent event) throws Exception {
		String relatedCoursesElementName = "relatedCourses";
        for ( Iterator<?> it = element.elementIterator(relatedCoursesElementName); it.hasNext(); ) {
            Element relatedCoursesElement = (Element) it.next();
            for( Iterator<?> courseIt = relatedCoursesElement.elementIterator(courseElementName); courseIt.hasNext(); ){
            	elementCourse((Element)courseIt.next(), event);
            }    
         }
//        if (event.getMeetings() == null || event.getMeetings().size() == 0){
//        	throw(new Exception(relatedCoursesElementName + " element must contain at least one " + meetingElementName + " element"));
//        }
	}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:13,代码来源:EventImport.java

示例8: ClassInfo

import org.dom4j.Element; //导入方法依赖的package包/类
public ClassInfo(Element e) {
	iClassId = Long.valueOf(e.attributeValue("id"));
	String configId = e.attributeValue("configId");
	iConfigId = (configId == null ? null : Long.valueOf(configId));
	String offeringId = e.attributeValue("offeringId");
	iOfferingId = (offeringId == null ? null : Long.valueOf(offeringId));
	for (Iterator i = e.elementIterator("student"); i.hasNext(); ) {
		iStudents.add(new StudentInfo((Element)i.next()));
	}
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:11,代码来源:StudentGroupInfo.java

示例9: bindMapSecondPass

import org.dom4j.Element; //导入方法依赖的package包/类
/**
 * Called for Maps
 */
public static void bindMapSecondPass(Element node, Map model, java.util.Map classes, Mappings mappings) throws MappingException {

	bindCollectionSecondPass(node, model, classes, mappings);

	Iterator iter = node.elementIterator();
	while( iter.hasNext() ) {
		Element subnode = (Element) iter.next();
		String name = subnode.getName();

		if ( "index".equals(name) ) {
			SimpleValue value = new SimpleValue( model.getCollectionTable() );
			bindSimpleValue(subnode, value, model.isOneToMany(), IndexedCollection.DEFAULT_INDEX_COLUMN_NAME, mappings);
			model.setIndex(value);
			if ( model.getIndex().getType()==null ) {
				throw new MappingException( "map index element must specify a type" + model.getRole() );
			}
		}
		else if ( "index-many-to-many".equals(name) ) {
			ManyToOne mto = new ManyToOne( model.getCollectionTable() );
			bindManyToOne( subnode, mto, IndexedCollection.DEFAULT_INDEX_COLUMN_NAME, model.isOneToMany(), mappings );
			model.setIndex(mto);

		}
		else if ( "composite-index".equals(name) ) {
			Component component = new Component( model.getCollectionTable() );
			bindComponent(subnode, component, null, model.getRole(), "index", model.isOneToMany(), mappings);
			model.setIndex(component);
		}
		else if ( "index-many-to-any".equals(name) ) {
			Any any = new Any( model.getCollectionTable() );
			bindAny( subnode, any, model.isOneToMany(), mappings );
			model.setIndex(any);
		}
	}

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:40,代码来源:Binder.java

示例10: load

import org.dom4j.Element; //导入方法依赖的package包/类
public void load(Element root) {
	clear();
	int version = Integer.parseInt(root.attributeValue("version"));
	if (version==1) {
		for (Iterator i=root.elementIterator("entry");i.hasNext();) {
			Element el = (Element)i.next();
			setProperty(el.attributeValue("key"),el.getText());
		}
	}
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:11,代码来源:PropertiesInfo.java

示例11: generate

import org.dom4j.Element; //导入方法依赖的package包/类
public void generate() throws IOException, DocumentException {
	Document document = read(iConfig);
	Element root = document.getRootElement();
	Element sessionFactoryElement = root.element("session-factory");
	for (Iterator<Element> i = sessionFactoryElement.elementIterator("mapping"); i.hasNext(); ) {
		Element m = i.next();
		String resource = m.attributeValue("resource");
		if (resource == null) continue;
		generate(read(resource).getRootElement(), null);
	}
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:12,代码来源:DoubleVarcharSizes.java

示例12: load

import org.dom4j.Element; //导入方法依赖的package包/类
public void load(Element root) {
	int version = Integer.parseInt(root.attributeValue("version"));
	if (version==sVersion) {
		iVariables.clear();
		for (Iterator i1=root.elementIterator("var");i1.hasNext();) {
			CBSVariable var = new CBSVariable((Element)i1.next());
			iVariables.put(new Long(var.getId()),var);
		}
	}
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:11,代码来源:ExamConflictStatisticsInfo.java

示例13: elementDates

import org.dom4j.Element; //导入方法依赖的package包/类
private HashMap<String, Vector<Calendar>> elementDates(Element element) throws Exception {
	Vector<Calendar> startDates = new Vector<Calendar>();
	Vector<Calendar> endDates = new Vector<Calendar>();
	String elementName = "date";
       if(element.element(elementName) != null){
       	for (Iterator<?> it = element.elementIterator(elementName); it.hasNext();){
			Element dateElement = (Element) it.next();
			Calendar startDate = null;
			Calendar endDate = null;
			if(dateFormat == null) {								
				startDate = getCalendarForDate(getRequiredStringAttribute(dateElement, "startDate", elementName));
				endDate = getCalendarForDate(getRequiredStringAttribute(dateElement, "endDate", elementName));;
			} else {
				startDate = Calendar.getInstance();
				startDate.setTime(CalendarUtils.getDate(getRequiredStringAttribute(dateElement, "startDate", elementName), dateFormat));
				endDate = Calendar.getInstance();
				endDate.setTime(CalendarUtils.getDate(getRequiredStringAttribute(dateElement, "endDate", elementName), dateFormat));
			}
			if (startDate == null){
				throw new Exception("For element 'date' a 'startDate' is required, unable to parse given date");
			}
			if (endDate == null){
				throw new Exception("For element 'date' a 'endDate' is required, unable to parse given date");
			}				
			if (endDate.before(startDate)){
				endDate.add(Calendar.YEAR, 1);
			}
			startDates.add(startDate);
			endDates.add(endDate);				
		}
       }
       if (startDates.size() > 0){
       	HashMap<String, Vector<Calendar>> dates = new HashMap<String, Vector<Calendar>>();
       	dates.put("startDates", startDates);
       	dates.put("endDates", endDates);
       	return(dates);
       } else {
       	return(null);
       }
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:41,代码来源:BaseCourseOfferingImport.java

示例14: readConfiguration

import org.dom4j.Element; //导入方法依赖的package包/类
public MappingDescriptor readConfiguration(String fileAddress){
    MappingDescriptor mappingDescriptor=new MappingDescriptor();
    Document document = readXml(fileAddress);
    Element rootElement=document.getRootElement();
    for(Iterator<Element> i=rootElement.elementIterator("class");i.hasNext();){
        Element classElement =  i.next();
        MappingDescriptor.ClassDescriptor classDescriptor=new MappingDescriptor.ClassDescriptor();
        classDescriptor.setClassAttribute(readClassAttribute(classElement.attributes()));
        classDescriptor.setId(readId(classElement.element("id")));
        classDescriptor.setProperties(readProperties(classElement.elements("property")));
        mappingDescriptor.setClassDescriptor(classDescriptor);
    }
    return mappingDescriptor;
}
 
开发者ID:Hang-Hu,项目名称:SimpleController,代码行数:15,代码来源:DatabaseXmlReader.java

示例15: addProperties

import org.dom4j.Element; //导入方法依赖的package包/类
private void addProperties(Element parent) {
	Iterator iter = parent.elementIterator("property");
	while ( iter.hasNext() ) {
		Element node = (Element) iter.next();
		String name = node.attributeValue("name");
		String value = node.getText().trim();
		log.debug(name + "=" + value);
		properties.setProperty(name, value);
		if ( !name.startsWith("hibernate") ) properties.setProperty("hibernate." + name, value);
	}
	Environment.verifyProperties(properties);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:13,代码来源:Configuration.java


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