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


Java Element.getChildElements方法代碼示例

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


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

示例1: getTagList

import nu.xom.Element; //導入方法依賴的package包/類
public static String getTagList(Project pjr){
	try {
	  String filepath = FileStorage.JN_DOCPATH + ".projects";
	  Builder builder = new Builder();
    Document projects = builder.build(new InputStreamReader(new FileInputStream(filepath)), "UTF-8");
 	String taglist="";
 	Elements prjs = projects.getRootElement().getChildElements("project");
 	  for (int i = 0; i < prjs.size(); i++) {
 		  String pid = ((Element) prjs.get(i)).getAttribute("id").getValue();
 		  if (pid.equals(pjr.getID())){
 			  Element tags=prjs.get(i).getFirstChildElement("tags");
 			  Elements tagli=tags.getChildElements("tag");
 			  if (tagli.size()<=0) return "no";
 			  for (int j = 0; j < tagli.size(); j++) {
 				  taglist+=tagli.get(j).getAttributeValue("name")+" - ";
 			  }
 			break;  
 		  }
 	  }
 	  return taglist;
	} catch (Exception e) {
		Util.error(e);
		return "no";
	}
}
 
開發者ID:ser316asu,項目名稱:Neukoelln_SER316,代碼行數:26,代碼來源:ProjectImpl.java

示例2: addTag

import nu.xom.Element; //導入方法依賴的package包/類
@Override
public boolean addTag(String tag) {

	Element tagsNode = _root.getFirstChildElement("tags");	
	
	// check if tag already exists
	Elements tags = tagsNode.getChildElements();
	for (int i = 0; i < tags.size(); i++) {
		if (tags.get(i).getAttributeValue("name").equals(tag)) {
			return false;
		}
	}
		
	Element tagNode = new Element("tag");
	tagNode.addAttribute(new Attribute("name",tag));
	tagsNode.appendChild(tagNode);
	return true;

}
 
開發者ID:ser316asu,項目名稱:Neukoelln_SER316,代碼行數:20,代碼來源:ProjectImpl.java

示例3: getDay

import nu.xom.Element; //導入方法依賴的package包/類
public Element getDay(CalendarDate date, Element month) {
	Element day = null;
	Elements days = month.getChildElements("day");
	if (days.size() == 0) {
		return null;
	}
	else {
		for (int i = 0; i < days.size(); i++) {
			if (Integer.parseInt(days.get(i).getAttributeValue("day").toString()) == date.getDay()) {
				day = days.get(i);
				break;
			}
		}
	}
	return day;
}
 
開發者ID:ser316asu,項目名稱:SER316-Aachen,代碼行數:17,代碼來源:DTDEventManager.java

示例4: getActualLocForProject

import nu.xom.Element; //導入方法依賴的package包/類
public static int getActualLocForProject(String targetid, Element rootElement) {
  Elements projectElements = rootElement.getChildElements(PSP.ELEMENT_NAME);
   Element projectElement = null;
   Element locElement = null;
   int value = 0;
   
   if (projectElements != null) {      
     for (int i = 0; i < projectElements.size(); i++) {
       String projectid = projectElements.get(i).getAttributeValue(PSP.ID_ATTRIBUTE);
       
       if (projectid.equals(targetid)) {
         projectElement = projectElements.get(i);
         locElement = projectElement.getFirstChildElement(ELEMENT_NAME);
         
         try {
           value = Integer.valueOf(locElement.getValue());
         }
         catch (Exception ex) {
           // do nothing here
         }
       }               
     }     
   }
   
   return value;
}
 
開發者ID:ser316asu,項目名稱:Neukoelln_SER316,代碼行數:27,代碼來源:LocManager.java

示例5: buildElements

import nu.xom.Element; //導入方法依賴的package包/類
private void buildElements(Element parent) {
	Elements els = parent.getChildElements("task");
	for (int i = 0; i < els.size(); i++) {
		Element el = els.get(i);
		elements.put(el.getAttribute("id").getValue(), el);
		buildElements(el);
	}
}
 
開發者ID:ser316asu,項目名稱:Dahlem_SER316,代碼行數:9,代碼來源:TaskListImpl.java

示例6: getRepeatableEvents

import nu.xom.Element; //導入方法依賴的package包/類
public static Collection getRepeatableEvents() {
	Vector v = new Vector();
	Element rep = _root.getFirstChildElement("repeatable");
	if (rep == null)
		return v;
	Elements els = rep.getChildElements("event");
	for (int i = 0; i < els.size(); i++)
		v.add(new EventImpl(els.get(i)));
	return v;
}
 
開發者ID:ser316asu,項目名稱:SER316-Aachen,代碼行數:11,代碼來源:EventsManager.java

示例7: getMimeTypeByExt

import nu.xom.Element; //導入方法依賴的package包/類
public static MimeType getMimeTypeByExt(String ext) {
    Elements els = _root.getChildElements("mime-type");
    for (int i = 0; i < els.size(); i++) {
        Element el = els.get(i);
        Elements exts = el.getChildElements("ext");
        for (int j = 0; j < exts.size(); j++)
            if (exts.get(j).getValue().toLowerCase().equals(ext.toLowerCase()))
                return new MimeType(el);
    }
    return new MimeType();
}
 
開發者ID:ser316asu,項目名稱:Neukoelln_SER316,代碼行數:12,代碼來源:MimeTypesList.java

示例8: getHomeElement

import nu.xom.Element; //導入方法依賴的package包/類
protected static Element getHomeElement(Element homeProject, String listElement, String idElement, String targetId) {
  
  Element target = null;
  Element homeList = homeProject.getFirstChildElement(listElement);
  Elements homeYears = homeList.getChildElements();
  
  for (int yearIndex = 0; yearIndex < homeYears.size(); yearIndex++) {
    Element homeYearElement = homeYears.get(yearIndex);
    String homeYear = homeYearElement.getAttributeValue("year");
    Elements homeMonths = homeYearElement.getChildElements();
    
    for (int monthIndex = 0; monthIndex < homeMonths.size(); monthIndex++) {
      Element homeMonthElement = homeMonths.get(monthIndex);
      String homeMonth = homeMonthElement.getAttributeValue("month");
      Elements homeDays = homeMonthElement.getChildElements();
      
      for (int dayIndex = 0; dayIndex < homeDays.size(); dayIndex++) {
        Element homeDayElement = homeDays.get(dayIndex);
        String homeDay = homeDayElement.getAttributeValue("day");
        String homeDate = homeDayElement.getAttributeValue("date");
        Elements homeLogs = homeDayElement.getChildElements();
        
        for (int i = 0; i < homeLogs.size(); i++) {
          Element homeLog = homeLogs.get(i);
          String homeId = homeLog.getAttributeValue(idElement);
          
          if (homeId.equals(targetId)) {
            target = homeLog;
          }
        }
      }
    }      
  }
  
  return target;
}
 
開發者ID:ser316asu,項目名稱:Neukoelln_SER316,代碼行數:37,代碼來源:DataImporter.java

示例9: buildElements

import nu.xom.Element; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
private void buildElements(Element parent) {
	Elements els = parent.getChildElements("task");
	for (int i = 0; i < els.size(); i++) {
		Element el = els.get(i);
		elements.put(el.getAttribute("id").getValue(), el);
		buildElements(el);
	}
}
 
開發者ID:ser316asu,項目名稱:SER316-Munich,代碼行數:10,代碼來源:TaskListImpl.java

示例10: buildElements

import nu.xom.Element; //導入方法依賴的package包/類
private void buildElements(Element parent) {
    Elements els = parent.getChildElements("task");
    for (int i = 0; i < els.size(); i++) {
        Element el = els.get(i);
        elements.put(el.getAttribute("id").getValue(), el);
        buildElements(el);
    }
}
 
開發者ID:ser316asu,項目名稱:SER316-Dresden,代碼行數:9,代碼來源:TaskListImpl.java

示例11: getAllSubTasks

import nu.xom.Element; //導入方法依賴的package包/類
/**
 * All methods to obtain list of tasks are consolidated under getAllSubTasks and getActiveSubTasks.
 * If a root task is required, just send a null taskId
 */
public Collection getAllSubTasks(String commitId) {
	if ((commitId == null) || (commitId.length() == 0)) {
		return getAllRootTasks();
	}
	else {
        Element task = getTaskElement(commitId);
        if (task == null)
            return new Vector();
        Elements subTasks = task.getChildElements("task");
        return convertToTaskObjects(subTasks);    	    		
	}
}
 
開發者ID:ser316asu,項目名稱:Wilmersdorf_SER316,代碼行數:17,代碼來源:CommitListImpl.java

示例12: buildElements

import nu.xom.Element; //導入方法依賴的package包/類
private void buildElements(Element parent) {
	Elements els = parent.getChildElements("timelog");
	for (int i = 0; i < els.size(); i++) {
		Element el = els.get(i);
		elements.put(el.getAttribute("id").getValue(), el);
		buildElements(el);
	}
}
 
開發者ID:ser316asu,項目名稱:Wilmersdorf_SER316,代碼行數:9,代碼來源:TimeLogListImpl.java

示例13: buildElements

import nu.xom.Element; //導入方法依賴的package包/類
private void buildElements(Element parent) {
	Elements els = parent.getChildElements("commit");
	for (int i = 0; i < els.size(); i++) {
		Element el = els.get(i);
		elements.put(el.getAttribute("id").getValue(), el);
		buildElements(el);
	}
}
 
開發者ID:ser316asu,項目名稱:Wilmersdorf_SER316,代碼行數:9,代碼來源:CommitListImpl.java

示例14: getDaysEvents

import nu.xom.Element; //導入方法依賴的package包/類
private ArrayList<DTDEvent> getDaysEvents(CalendarDate date) {
		ArrayList<DTDEvent> ret = new ArrayList<DTDEvent>();
		Element tmp;
		Elements tmps;
//		System.out.println("goin in");
		tmp = getYear(date);
		if (tmp == null) {
			System.out.println("getDaysEvents year");
			return ret;
		}
		tmp = getMonth(date, tmp);
		if (tmp == null) {
			System.out.println("getDaysEvents month");
			return ret;
		}
		tmp = getDay(date, tmp);
		if (tmp == null) {
			System.out.println("getDaysEvents day");
			return ret;
		}
		tmps = tmp.getChildElements("event");
		if (tmps == null) {
			System.out.println("getDaysEvents events");
			return ret;
		}
		try {
			for (int i = 0; i < tmps.size(); i++) {
				ret.add(new DTDEvent(date, Integer.parseInt(tmps.get(i).getAttributeValue("hour")), 
						Integer.parseInt(tmps.get(i).getAttributeValue("minute")), tmps.get(i).getAttributeValue("message"), 
						parseBool(tmps.get(i).getAttributeValue("reminder")), tmps.get(i).getAttributeValue("email")));
			}
			System.out.println("size of ret" + ret.size());
		}
		catch (Exception e) {
			e.printStackTrace();
			System.out.println("getDaysEvents Exception");
			return null;
		}
		
		return ret;
	}
 
開發者ID:ser316asu,項目名稱:SER316-Aachen,代碼行數:42,代碼來源:DTDEventManager.java

示例15: upgrade1_1d1

import nu.xom.Element; //導入方法依賴的package包/類
private static void upgrade1_1d1(String[] projectIds) {
        for (int i = 0; i < projectIds.length; i++) {
            Util.debug("Upgrading project " + projectIds[i] + " from version 1.0 to version 1.1d1");
        
            String filePath = FileStorage.JN_DOCPATH + projectIds[i] + File.separator + ".tasklist";
            Document doc = FileStorage.openDocument(filePath);
                        
            Element root = doc.getRootElement();
            Elements tasks = root.getChildElements("task");
                        
            for (int j = 0; j < tasks.size(); j++) {                                
                Element task = tasks.get(j );

//	Decided not to change the date format after all but I'm leaving this code here 
//	in case we need it later. Ryan
//                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
//
//                Attribute startDateAttr = task.getAttribute("startDate");
//                Date startDate = (new CalendarDate(startDateAttr.getValue(),"/")).getDate();
//                startDateAttr.setValue(sdf.format(startDate));
//
//                Attribute endDateAttr = task.getAttribute("endDate");
//                if (endDateAttr != null) {
//                    Date endDate = (new CalendarDate(endDateAttr.getValue(),"/")).getDate();
//                    endDateAttr.setValue(sdf.format(endDate));                    
//                }
                
                Attribute parentAttr = task.getAttribute("parent");
            	if ((parentAttr == null) || (parentAttr.getValue() == "")) {
            		// no parent, do nothing here
            	}
            	else {
                	// put the task under the parent task
                    String parentId = parentAttr.getValue();
                    for (int k = 0; k < tasks.size(); k++) {
                        Element potentialParent = tasks.get(k);
                        if(parentId.equals(potentialParent.getAttribute("id").getValue())) {
                            // found parent, put self under it
                            task.removeAttribute(parentAttr);
                            task.detach();
                            potentialParent.appendChild(task);                            
                        }
                    }
            	}            	
            }
            doc.setDocType(getCurrentDocType());
            FileStorage.saveDocument(doc,filePath);
        }        
    }
 
開發者ID:ser316asu,項目名稱:SER316-Ingolstadt,代碼行數:50,代碼來源:TaskListVersioning.java


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