That works perfectly now. Thanks for your help. Gordon.
At 14:16 04/06/2003 -0400, you wrote:
>>>>> "GP" == Gordon <[EMAIL PROTECTED]> writes:
GP> hey. I have a problem removing a child node from a GP> node. Specifically, I'm trying to remove an Element from a GP> Document. My code is:
GP> Element elmt =doc.getElementById( id ); if( elmt == null ){ } GP> else{ Element discard = doc.removeChild(elmt); }
GP> This gives me a compile error:
found : org.w3c.dom.Node required: org.w3c.dom.Element discard = doc.removeChild(elmt);
GP> I don't understand this because elmt is an Element and not a Node, GP> and Node is a superinterface of Element anyway. Can anyone GP> explain this? I am using Batik 1.1.1 and jdk1.3.1 Thanks.
'discard' must be an Element. removeChild returns a Node. Also you don't want to call 'removeChild' on doc I think you want to call it on elmt's parent (unless elmt is the root element of the document).
elmt.getParent().removeChild(elmt); // From memory.
--- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.486 / Virus Database: 284 - Release Date: 29/05/2003
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
