當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。