>>>>> "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.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]