本文整理匯總了Java中nu.xom.Element.removeChild方法的典型用法代碼示例。如果您正苦於以下問題:Java Element.removeChild方法的具體用法?Java Element.removeChild怎麽用?Java Element.removeChild使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類nu.xom.Element
的用法示例。
在下文中一共展示了Element.removeChild方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: removeTag
import nu.xom.Element; //導入方法依賴的package包/類
@Override
public boolean removeTag(String tag) {
if (tag==null) return false;
tag = tag.toLowerCase();
Element tagsNode = _root.getFirstChildElement("tags");
Elements tags = tagsNode.getChildElements();
Element currentTag = null;
for (int i = 0; i < tags.size(); i++) {
currentTag = tags.get(i);
if (currentTag.getAttributeValue("name").equals(tag)) {
tagsNode.removeChild(currentTag);
return true;
}
}
return false;
}
示例2: removeTask
import nu.xom.Element; //導入方法依賴的package包/類
/**
* @see net.sf.memoranda.TaskList#removeTask(import net.sf.memoranda.Task)
*/
public void removeTask(Task task) {
String parentTaskId = task.getParentId();
if (parentTaskId == null) {
_root.removeChild(task.getContent());
}
else {
Element parentNode = getTaskElement(parentTaskId);
parentNode.removeChild(task.getContent());
}
elements.remove(task.getID());
}
示例3: removeTask
import nu.xom.Element; //導入方法依賴的package包/類
/**
* @see net.sf.memoranda.TaskList#removeTask(Task)
*/
public void removeTask(Task task) {
String parentTaskId = task.getParentId();
if (parentTaskId == null) {
_root.removeChild(task.getContent());
}
else {
Element parentNode = getTaskElement(parentTaskId);
parentNode.removeChild(task.getContent());
}
elements.remove(task.getID());
}
示例4: removeTimeLog
import nu.xom.Element; //導入方法依賴的package包/類
@Override
public void removeTimeLog(TimeLog timeLog) {
String parentTaskID = timeLog.getParentId();
if (parentTaskID == null) {
_root.removeChild(timeLog.getContent());
}
else {
Element parentNode = getTimeLogElement(parentTaskID);
parentNode.removeChild(timeLog.getContent());
}
elements.remove(timeLog.getTimeLogID());
}
示例5: removeAccidentalFrom
import nu.xom.Element; //導入方法依賴的package包/類
private void removeAccidentalFrom(Element noteElement) {
Element accidental = noteElement.getFirstChildElement("accidental");
if (accidental != null) {
noteElement.removeChild(accidental);
}
}
示例6: removeEvent
import nu.xom.Element; //導入方法依賴的package包/類
public boolean removeEvent(CalendarDate date, int hour, int minute, String message) {
boolean success = false;
System.out.println("attempting to remove event: " + "hour: " + hour + " minute: " + minute);
Element year;
Element month;
Element day;
year = getYear(date);
if (year == null) {
return false;
}
month = getMonth(date, year);
if(month == null) {
return false;
}
day = getDay(date, month);
if (day == null) {
return false;
}
Elements tmps = day.getChildElements();
System.out.println("events: " + tmps.size());
boolean delete[] = new boolean[tmps.size()];
try {
for (int i = 0; i < tmps.size(); i ++) {
System.out.println(tmps.get(i).getAttributeValue("hour") + " : " + tmps.get(i).getAttributeValue("minute"));
System.out.println(tmps.get(i).getAttributeValue("message"));
if (hour == Integer.parseInt(tmps.get(i).getAttributeValue("hour")) && minute == Integer.parseInt(tmps.get(i).getAttributeValue("minute"))) {
delete[i] = true;
success = true;
}
else {
delete[i] = false;
}
}
} catch (Exception e) {
e.printStackTrace();
}
/*
* Remove in reverse order
*/
for (int i = delete.length-1; i >= 0 ; i--) {
System.out.println(delete[i]);
if (delete[i]) {
day.removeChild(i);
}
}
if (success) {
updateDateEvents(date);
if (CalendarDate.today() == date) {
updateScheduledEvents();
}
}
return success;
}