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


Java Element.appendChild方法代碼示例

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


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

示例1: createEvent

import nu.xom.Element; //導入方法依賴的package包/類
public static Event createEvent(
	CalendarDate date,
	int hh,
	int mm,
	String text) {
	Element el = new Element("event");
	el.addAttribute(new Attribute("id", Util.generateId()));
	el.addAttribute(new Attribute("hour", String.valueOf(hh)));
	el.addAttribute(new Attribute("min", String.valueOf(mm)));
	el.appendChild(text);
	Day d = getDay(date);
	if (d == null)
		d = createDay(date);
	d.getElement().appendChild(el);
	return new EventImpl(el);
}
 
開發者ID:ser316asu,項目名稱:Neukoelln_SER316,代碼行數:17,代碼來源:EventsManager.java

示例2: createDefectLog

import nu.xom.Element; //導入方法依賴的package包/類
public static DefectLog createDefectLog(LocalDateTime date, int number, PSP.Defect type, PSP.Phase inject, PSP.Phase remove, int fixMin, int reference, String description) {
  refresh();
	Element element = new Element(DefectLog.ELEMENT_NAME);
	DateTimeFormatter formatter = DateTimeFormatter.ofPattern(DefectLog.DATE_FORMAT);
	element.addAttribute(new Attribute(DefectLog.ID_ELEMENT, Util.generateId()));
	element.addAttribute(new Attribute(DefectLog.DATE_ELEMENT, date.format(formatter)));
	element.addAttribute(new Attribute(DefectLog.NUMBER_ELEMENT, String.valueOf(number)));
	element.addAttribute(new Attribute(DefectLog.TYPE_ELEMENT, type.toString()));
	element.addAttribute(new Attribute(DefectLog.INJECT_ELEMENT, inject.toString()));
	element.addAttribute(new Attribute(DefectLog.REMOVE_ELEMENT, remove.toString()));
	element.addAttribute(new Attribute(DefectLog.FIX_ELEMENT, String.valueOf(fixMin)));
	element.addAttribute(new Attribute(DefectLog.REFERENCE_ELEMENT, String.valueOf(reference)));
	element.addAttribute(new Attribute(DefectLog.DESCRIPTION_ELEMENT, description));
	element.appendChild(description);
	Day d = getDay(date);
	
	if (d == null)
		d = createDay(date);
	
	d.getElement().appendChild(element);
	return new DefectLog(element);
}
 
開發者ID:ser316asu,項目名稱:Neukoelln_SER316,代碼行數:23,代碼來源:DefectLogManager.java

示例3: createTimelog

import nu.xom.Element; //導入方法依賴的package包/類
public static TimeLog createTimelog(LocalDateTime timeStart, LocalDateTime timeEnd, int interruption,PSP.Phase phase, String comments) throws Exception {
  refresh();
	Element element = new Element(TimeLog.ELEMENT_NAME);
	DateTimeFormatter formatter = DateTimeFormatter.ofPattern(TimeLog.DATE_FORMAT);
	element.addAttribute(new Attribute(TimeLog.ID_NAME, Util.generateId()));
	element.addAttribute(new Attribute(TimeLog.TIME_START_NAME, timeStart.format(formatter)));
	element.addAttribute(new Attribute(TimeLog.TIME_STOP_NAME, timeEnd.format(formatter)));
	element.addAttribute(new Attribute(TimeLog.INTERRUPTION_NAME, String.valueOf(interruption)));
	element.addAttribute(new Attribute(TimeLog.PHASE_NAME, phase.toString()));
	element.addAttribute(new Attribute(TimeLog.COMMENTS_NAME, comments));		
	element.appendChild(comments);
	Day d = getDay(timeStart);
	if (d == null)
		d = createDay(timeStart);
	d.getElement().appendChild(element);
	return new TimeLog(element);
}
 
開發者ID:ser316asu,項目名稱:Neukoelln_SER316,代碼行數:18,代碼來源:TimeLogManager.java

示例4: createEvent

import nu.xom.Element; //導入方法依賴的package包/類
public static Event createEvent(
	CalendarDate date,
	int hh,
	int mm,
	String text,
	boolean emailReminder,
	String emailAddress) {
	//== edit for email notification DILTDICKER
	Element el = new Element("event");
	el.addAttribute(new Attribute("id", Util.generateId()));
	el.addAttribute(new Attribute("hour", String.valueOf(hh)));
	el.addAttribute(new Attribute("min", String.valueOf(mm)));
	el.addAttribute(new Attribute("remind", String.valueOf(emailReminder)));			// DILTDICKER
	el.addAttribute(new Attribute("address", emailAddress));							// DILTDICKER
	el.appendChild(text);
	Day d = getDay(date);
	if (d == null)
		d = createDay(date);
	d.getElement().appendChild(el);
	return new EventImpl(el);
}
 
開發者ID:ser316asu,項目名稱:SER316-Aachen,代碼行數:22,代碼來源:EventsManager.java

示例5: setUp

import nu.xom.Element; //導入方法依賴的package包/類
@Before
public void setUp() throws Exception {
	Project project = ProjectManager.createProject("1","FirstProject",new CalendarDate(1,1,2017),new CalendarDate(1,1,2018));
	Element root = new Element("psp");
	Element projectNode = new Element(PSP.ELEMENT_NAME);
	projectNode.addAttribute(new Attribute(PSP.ID_ATTRIBUTE, project.getID()));
	Element listNode = new Element(EstimateManager.ELEMENT_NAME);
	Element estimateNode = new Element(EstimateManager.CHILD_ELEMENT);
	estimateNode.addAttribute(new Attribute("module","test module"));
	estimateNode.addAttribute(new Attribute("loc", "55"));
	estimateNode.addAttribute(new Attribute("phase", PSP.Phase.Code.toString()));
	estimateNode.addAttribute(new Attribute("minutes", "90"));
	estimateNode.addAttribute(new Attribute("comments","this is a test"));		
	root.appendChild(projectNode);
	projectNode.appendChild(listNode);
	listNode.appendChild(estimateNode);
	PSP.root = root;
	testLog = ((Estimate[])EstimateManager.getEstimatesForProject(project).toArray(new Estimate[0]))[0];
}
 
開發者ID:ser316asu,項目名稱:Neukoelln_SER316,代碼行數:20,代碼來源:EstimateTest.java

示例6: clefElementFrom

import nu.xom.Element; //導入方法依賴的package包/類
private Element clefElementFrom(int number, String sign, int line) {
    Element elClef = new Element("clef");
    elClef.addAttribute(new Attribute("number", Integer.toString(number)));
    Element elSign = new Element("sign");
    elSign.appendChild(sign);
    elClef.appendChild(elSign);
    Element elLine = new Element("line");
    elLine.appendChild(Integer.toString(line));
    elClef.appendChild(elLine);
    return elClef;
}
 
開發者ID:joshschriever,項目名稱:LiveNotes,代碼行數:12,代碼來源:MusicXmlRenderer.java

示例7: createSticker

import nu.xom.Element; //導入方法依賴的package包/類
public static void createSticker(String text, int prior) {
	Element el = new Element("sticker");
	el.addAttribute(new Attribute("id", Util.generateId()));
	el.addAttribute(new Attribute("priority", prior+""));
	el.appendChild(text);
	_root.appendChild(el);
}
 
開發者ID:ser316asu,項目名稱:SER316-Ingolstadt,代碼行數:8,代碼來源:EventsManager.java

示例8: createEvent

import nu.xom.Element; //導入方法依賴的package包/類
private static Event createEvent(int hh, int mm, String text, Calendar start, Calendar end) {
	Element el = new Element("event");
	el.addAttribute(new Attribute("startDate", start.toString()));
	el.addAttribute(new Attribute("endDate", end.toString()));
	el.addAttribute(new Attribute("id", Util.generateId()));
	el.addAttribute(new Attribute("hour", String.valueOf(hh)));
	el.addAttribute(new Attribute("min", String.valueOf(mm)));
	el.appendChild(text);
	return new EventImpl(el);
}
 
開發者ID:ser316asu,項目名稱:SER316-Ingolstadt,代碼行數:11,代碼來源:testEvent.java

示例9: setUp

import nu.xom.Element; //導入方法依賴的package包/類
@Before
public void setUp() throws Exception {
	project = ProjectManager.createProject("1","FirstProject",new CalendarDate(1,1,2017),new CalendarDate(1,1,2018));
	Element root = new Element("psp");
	Element projectNode = new Element(PSP.ELEMENT_NAME);
	projectNode.addAttribute(new Attribute(PSP.ID_ATTRIBUTE, project.getID()));
	Element locNode = new Element(LocManager.ELEMENT_NAME);		
	locNode.appendChild("101");		
	root.appendChild(projectNode);
	projectNode.appendChild(locNode);		
	PSP.root = root;		
}
 
開發者ID:ser316asu,項目名稱:Neukoelln_SER316,代碼行數:13,代碼來源:LocManagerTest.java

示例10: setUp

import nu.xom.Element; //導入方法依賴的package包/類
@Before
public void setUp() throws Exception {
	Project project = ProjectManager.createProject("1","FirstProject",new CalendarDate(1,1,2017),new CalendarDate(1,1,2018));
	Element root = new Element("psp");
	Element projectNode = new Element("project");
	projectNode.addAttribute(new Attribute("projectid", "1"));
	Element timeloglistNode = new Element("timeloglist");
	Element yearNode = new Element("year");
	yearNode.addAttribute(new Attribute("year", "2017"));
	Element monthNode = new Element("month");
	monthNode.addAttribute(new Attribute("month", "1"));
	Element dayNode = new Element("day");
	dayNode.addAttribute(new Attribute("day","1"));
	dayNode.addAttribute(new Attribute("date", "1/1/2017"));
	Element timelog = new Element("timelog");
	timelog.addAttribute(new Attribute("id","1"));
	timelog.addAttribute(new Attribute("phase","Code"));
	timelog.addAttribute(new Attribute("interruption","0"));
	timelog.addAttribute(new Attribute("comments","test"));
	timelog.addAttribute(new Attribute("timestart","2017-04-07 17:24"));
	timelog.addAttribute(new Attribute("timestop","2017-04-07 17:25"));
	root.appendChild(projectNode);
	projectNode.appendChild(timeloglistNode);
	timeloglistNode.appendChild(yearNode);
	yearNode.appendChild(monthNode);
	monthNode.appendChild(dayNode);
	dayNode.appendChild(timelog);
	PSP.root = root;
	testLog = ((TimeLog[])TimeLogManager.getTimeLogsForProject(project).toArray(new TimeLog[0]))[0];
}
 
開發者ID:ser316asu,項目名稱:Neukoelln_SER316,代碼行數:31,代碼來源:TimeLogTest.java

示例11: setUp

import nu.xom.Element; //導入方法依賴的package包/類
@Before
public void setUp() {
    Element element = new Element("elem", "http://www.example.com/my");
    element.setNamespacePrefix("my");
    element.addAttribute(attr1);
    element.addAttribute(attr2);
    element.addAttribute(attr3);
    element.appendChild("text");
    element.appendChild(child1);
    element.appendChild(child2);
    element.appendChild(child3);

    node = new XomElement(element);
}
 
開發者ID:SimY4,項目名稱:xpath-to-xml,代碼行數:15,代碼來源:XomElementTest.java

示例12: 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-Aachen,代碼行數:50,代碼來源:TaskListVersioning.java

示例13: addExtension

import nu.xom.Element; //導入方法依賴的package包/類
public void addExtension(String ext) {
    Element exe = new Element("ext");
    exe.appendChild(ext);
    _root.appendChild(exe);
}
 
開發者ID:ser316asu,項目名稱:Reinickendorf_SER316,代碼行數:6,代碼來源:MimeType.java

示例14: createTimeLog

import nu.xom.Element; //導入方法依賴的package包/類
@Override
public TimeLog createTimeLog(CalendarDate startDate, String parentTimeLogID, String timeLogTaskName, 
		int startHour, int startMin, int startPeriod, int endHour, int endMin, int endPeriod,
		int interruptTime, int deltaTime, String description) {
      
	Element el = new Element("timelog");
       el.addAttribute(new Attribute("startDate", startDate.toString()));
       
	String id = Util.generateId();
       el.addAttribute(new Attribute("id", id));
       
       el.addAttribute(new Attribute("startHour", String.valueOf(startHour)));
       el.addAttribute(new Attribute("startMin", String.valueOf(startMin)));
       el.addAttribute(new Attribute("startPeriod", String.valueOf(startPeriod)));
       
       el.addAttribute(new Attribute("endHour", String.valueOf(endHour)));
       el.addAttribute(new Attribute("endMin", String.valueOf(endMin)));
       el.addAttribute(new Attribute("endPeriod",  String.valueOf(endPeriod)));
       
       
       el.addAttribute(new Attribute("interruptTime", String.valueOf(interruptTime)));
       el.addAttribute(new Attribute("deltaTime", String.valueOf(deltaTime)));
       
               
       Element txt = new Element("timeLogTaskName");
       txt.appendChild(timeLogTaskName);
       el.appendChild(txt);

       Element desc = new Element("description");
       desc.appendChild(description);
       el.appendChild(desc);
       
       if (parentTimeLogID == null) {
           _root.appendChild(el);
       }
       else {
           Element parent = getTimeLogElement(parentTimeLogID);
           parent.appendChild(el);
       }
       
	
       Util.debug("Created timelog with parent " + parentTimeLogID);
	elements.put(id, el);
	
       
       return new TimeLogImpl(el, this);
}
 
開發者ID:ser316asu,項目名稱:Wilmersdorf_SER316,代碼行數:48,代碼來源:TimeLogListImpl.java

示例15: addExtension

import nu.xom.Element; //導入方法依賴的package包/類
/**
 * Add extensions. 
 * @param ext
 */
public void addExtension(String ext) {
    Element exe = new Element("ext");
    exe.appendChild(ext);
    _root.appendChild(exe);
}
 
開發者ID:ser316asu,項目名稱:SER316-Dresden,代碼行數:10,代碼來源:MimeType.java


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