InterviewSolution
| 1. |
How Do I Remove An Element Or Other Content? |
|
Answer» Use the methods on the List returned by get Children () or get Content (). JDOM does not need special methods because the methods already EXIST in List. For example to remove an ELEMENT from a list of children: List children = parent.getChildren (); Children. Remove (element); // given child Children. Remove (0); // FIRST child Other methods on List provide options to remove all children, add a child at a given LOCATION, and so on. If you have a particular Element or other Content that you WANT to remove from its parent, you can detach the Content with the Content. Detach () method. Use the methods on the List returned by get Children () or get Content (). JDOM does not need special methods because the methods already exist in List. For example to remove an element from a list of children: List children = parent.getChildren (); Children. Remove (element); // given child Children. Remove (0); // first child Other methods on List provide options to remove all children, add a child at a given location, and so on. If you have a particular Element or other Content that you want to remove from its parent, you can detach the Content with the Content. Detach () method. |
|