[jdom-interest] Processing XML with Java book

Elliotte Rusty Harold elharo at metalab.unc.edu
Fri Dec 13 06:04:17 PST 2002


At 2:38 PM +0100 12/13/02, Antonello Dell'Armi wrote:
>In the book Processing XML with Java chapter 15 (The JDOM Model ) i read
>[...]
>For example, this deletes the first link child element of the channel element:
>
>channel.removeChild(channel.getChild("link"));
>
>but  getChild(java.lang.String name) return an element and there is 
>no method removeChild(Element) , but only 
>removeChild(java.lang.String name) or removeChild(java.lang.String 
>name, Namespace ns) what do you think about?
>I have a problem to delete a child. What method can i use?


That's a mistake all right. Thanks for the heads up. I'll fix it. In 
the meantime, it should be removeContent instead of removeChild; i.e.:

channel.removeContent(channel.getChild("link"));
-- 

+-----------------------+------------------------+-------------------+
| Elliotte Rusty Harold | elharo at metalab.unc.edu | Writer/Programmer |
+-----------------------+------------------------+-------------------+
|          XML in a  Nutshell, 2nd Edition (O'Reilly, 2002)          |
|              http://www.cafeconleche.org/books/xian2/              |
|  http://www.amazon.com/exec/obidos/ISBN%3D0596002920/cafeaulaitA/  |
+----------------------------------+---------------------------------+
|  Read Cafe au Lait for Java News:  http://www.cafeaulait.org/      |
|  Read Cafe con Leche for XML News: http://www.cafeconleche.org/    |
+----------------------------------+---------------------------------+



More information about the jdom-interest mailing list