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


Java Element.getFirstChildElement方法代碼示例

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


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

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

示例2: updateProject

import nu.xom.Element; //導入方法依賴的package包/類
protected static void updateProject(Element importProject, Element homeProject, boolean override) throws Exception {
  UpdateLogsParameter timeLogParam = UpdateLogsParameter.GetTimeLogParameter(homeProject, importProject, override);
  UpdateLogsParameter defectLogParam = UpdateLogsParameter.GetDefectLogParameter(homeProject, importProject, override);    
  updateLogs(timeLogParam);
  updateLogs(defectLogParam);
  updateEstimates(homeProject, importProject, override);
  Element importLocElement = importProject.getFirstChildElement(LocManager.ELEMENT_NAME);
      
  if (importLocElement != null) {
    int locValue = Integer.valueOf(importLocElement.getValue()); // valid test
    Element homeLocElement = homeProject.getFirstChildElement(LocManager.ELEMENT_NAME);
    Node newNode = importLocElement.copy();
    
    if (homeLocElement != null) {        
      homeLocElement.getParent().appendChild(newNode);
      homeLocElement.getParent().removeChild(homeLocElement);
    } else {
      homeProject.appendChild(newNode);
    }
  }
}
 
開發者ID:ser316asu,項目名稱:Neukoelln_SER316,代碼行數:22,代碼來源:DataImporter.java

示例3: handleRuntimeErrors

import nu.xom.Element; //導入方法依賴的package包/類
/**
 * 
 * @param error
 * @return
 */
private DocumentPositionedInfo handleRuntimeErrors(Element error){
	String href = error.getAttributeValue("href");
	if (href == null || href.trim().length()==0)
		href = thePipelineURI;
	StringBuilder message = new StringBuilder();
	if (error.getAttribute("code") != null)
		message.append(error.getAttributeValue("code")+": ");
	if (error.getFirstChildElement("message") != null)
		message.append(error.getFirstChildElement("message").getValue());
	else
		message.append(error.getValue());
	
	return new DocumentPositionedInfo(DocumentPositionedInfo.SEVERITY_ERROR,
			message.toString(), href, 
			getPositionInfo(error.getAttributeValue("line")),
			getPositionInfo(error.getAttributeValue("column")));
}
 
開發者ID:xml-project,項目名稱:support-for-xmleditor,代碼行數:23,代碼來源:Adapter.java

示例4: getDefectLogsForProject

import nu.xom.Element; //導入方法依賴的package包/類
public static Collection getDefectLogsForProject(String targetid, Element rootElement) {
  Vector v = new Vector();
   Elements projectElements = rootElement.getChildElements(PSP.ELEMENT_NAME);
   Element projectElement = null;
   Element defectList = null;
   
   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);
         defectList = projectElement.getFirstChildElement(ELEMENT_NAME);
       }               
     }     
   }
   
   if (defectList != null) {
     Elements years = defectList.getChildElements("year");
     
     for (int y = 0; y < years.size(); y++) {
       Elements months = years.get(y).getChildElements("month");
       
       for (int m = 0; m < months.size(); m++) {
         Elements days = months.get(m).getChildElements("day");
         
         for (int d = 0; d < days.size(); d++) {
           Elements defects = days.get(d).getChildElements(CHILD_ELEMENT);
           
           for (int i = 0; i < defects.size(); i++) {
             v.add(new DefectLog(defects.get(i)));
           }
         }
       }
     }
   }
   
   Collections.sort(v);
   return v;	  
}
 
開發者ID:ser316asu,項目名稱:Neukoelln_SER316,代碼行數:41,代碼來源:DefectLogManager.java

示例5: getEstimatesForProject

import nu.xom.Element; //導入方法依賴的package包/類
public static Collection getEstimatesForProject(String targetid, Element rootElement) {
  refresh();
  Vector v = new Vector();
   Elements projectElements = rootElement.getChildElements(PSP.ELEMENT_NAME);
   Element projectElement = null;
   Element estimateRoot = null;
   Elements estimates = null;
   
   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);
         estimateRoot = projectElement.getFirstChildElement(ELEMENT_NAME);
       }               
     }     
   }
   
   if (estimateRoot != null) {
     estimates = estimateRoot.getChildElements(CHILD_ELEMENT);
       
     for (int i = 0; i < estimates.size(); i++) {
       v.add(new Estimate(estimates.get(i)));
     }
   }
   
   Collections.sort(v);
   return v;
}
 
開發者ID:ser316asu,項目名稱:Neukoelln_SER316,代碼行數:31,代碼來源:EstimateManager.java

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

示例7: getTimeLogsForProject

import nu.xom.Element; //導入方法依賴的package包/類
public static Collection getTimeLogsForProject(String targetid, Element rootElement) throws Exception {
  Vector v = new Vector();
   Elements projectElements = rootElement.getChildElements(PSP.ELEMENT_NAME);
   Element projectElement = null;
   Element timeLogList = null;
   
   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);
         timeLogList = projectElement.getFirstChildElement(ELEMENT_NAME);
       }               
     }     
   }
   
   if (timeLogList != null) {
     Elements years = timeLogList.getChildElements("year");
     
     for (int y = 0; y < years.size(); y++) {
       Elements months = years.get(y).getChildElements("month");
       
       for (int m = 0; m < months.size(); m++) {
         Elements days = months.get(m).getChildElements("day");
         
         for (int d = 0; d < days.size(); d++) {
           Elements timeLogs = days.get(d).getChildElements(CHILD_ELEMENT);
           
           for (int i = 0; i < timeLogs.size(); i++) {
             v.add(new TimeLog(timeLogs.get(i)));
           }
         }
       }
     }
   }
   
   Collections.sort(v);
   return v;
}
 
開發者ID:ser316asu,項目名稱:Neukoelln_SER316,代碼行數:41,代碼來源:TimeLogManager.java

示例8: handleCompilationError

import nu.xom.Element; //導入方法依賴的package包/類
/**
 * 
 * @param error
 * @return
 */
private DocumentPositionedInfo handleCompilationError(Element error){
	Element position = error.getFirstChildElement("position");
	String href = position.getAttributeValue("href");
	if (href == null || href.trim().length()==0)
		href = thePipelineURI;
	StringBuilder message = new StringBuilder();
	if (error.getAttribute("code")!=null)
		message.append("err:"+error.getAttributeValue("code")+": ");
	message.append(error.getFirstChildElement("description").getValue()+" ("+error.getFirstChildElement("message").getValue()+")");
	return new DocumentPositionedInfo(DocumentPositionedInfo.SEVERITY_ERROR, 
			message.toString(), href, 
			getPositionInfo(position.getAttributeValue("line")), getPositionInfo(position.getAttributeValue("column")));
}
 
開發者ID:xml-project,項目名稱:support-for-xmleditor,代碼行數:19,代碼來源:Adapter.java

示例9: updateLogs

import nu.xom.Element; //導入方法依賴的package包/類
protected static void updateLogs(UpdateLogsParameter param) throws Exception {
  Element importProject = param.getImportProject();
  Element homeProject = param.getHomeProject();
  String listElement = param.getListElement();
  String idElement = param.getIdElement();
  boolean override = param.isOverride();
  
  Element importList = importProject.getFirstChildElement(listElement);
  
  if (importList != null) {
    Elements importYears = importList.getChildElements();
    
    for (int yearIndex = 0; yearIndex < importYears.size(); yearIndex++) {
      Element importYearElement = importYears.get(yearIndex);
      String importYear = importYearElement.getAttributeValue("year");
      Elements importMonths = importYearElement.getChildElements();
      
      for (int monthIndex = 0; monthIndex < importMonths.size(); monthIndex++) {
        Element importMonthElement = importMonths.get(monthIndex);
        String importMonth = importMonthElement.getAttributeValue("month");
        Elements importDays = importMonthElement.getChildElements();
        
        for (int dayIndex = 0; dayIndex < importDays.size(); dayIndex++) {
          Element importDayElement = importDays.get(dayIndex);
          String importDay = importDayElement.getAttributeValue("day");
          String importDate = importDayElement.getAttributeValue("date");
          Elements importLogs = importDayElement.getChildElements();
          
          for (int i = 0; i < importLogs.size(); i++) {
            Element importLog = importLogs.get(i);
            // test import data
            if (listElement.equals(TimeLogManager.ELEMENT_NAME)) {
              TimeLog timelog = new TimeLog(importLog);
            } else { // defect log
              DefectLog defectLog = new DefectLog(importLog);
            }
            
            String importId = importLog.getAttributeValue(idElement);
            Element homeLog = getHomeElement(homeProject, listElement, idElement, importId);
            Node newNode = importLog.copy();
            
            if (homeLog != null) {
              if (override) {
                homeLog.getParent().appendChild(newNode);
                homeLog.getParent().removeChild(homeLog);
              }
            } else {
              Element dayElement = getDayElement(homeProject, listElement, importDate);
              dayElement.appendChild(newNode);
            }
          }
        }
      }      
    }
  }
}
 
開發者ID:ser316asu,項目名稱:Neukoelln_SER316,代碼行數:57,代碼來源:DataImporter.java

示例10: removeAccidentalFrom

import nu.xom.Element; //導入方法依賴的package包/類
private void removeAccidentalFrom(Element noteElement) {
    Element accidental = noteElement.getFirstChildElement("accidental");
    if (accidental != null) {
        noteElement.removeChild(accidental);
    }
}
 
開發者ID:joshschriever,項目名稱:LiveNotes,代碼行數:7,代碼來源:MusicXmlRenderer.java

示例11: notMarkedAsChord

import nu.xom.Element; //導入方法依賴的package包/類
private static boolean notMarkedAsChord(Element noteElement) {
    return noteElement.getFirstChildElement("chord") == null
            && !isFollowedByBackup(noteElement);
}
 
開發者ID:joshschriever,項目名稱:LiveNotes,代碼行數:5,代碼來源:MusicXmlRenderer.java

示例12: isEndOfTie

import nu.xom.Element; //導入方法依賴的package包/類
private static boolean isEndOfTie(Element noteElement) {
    Element tie = noteElement.getFirstChildElement("tie");
    return tie != null && tie.getAttributeValue("type").equals("stop");
}
 
開發者ID:joshschriever,項目名稱:LiveNotes,代碼行數:5,代碼來源:MusicXmlRenderer.java


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