xom-interest AT lists.ibiblio.org
Subject: XOM API for Processing XML with Java
List archive
- From: Elliotte Rusty Harold <elharo AT metalab.unc.edu>
- To: xom-interest <xom-interest AT lists.ibiblio.org>
- Subject: [XOM-interest] removeChild returns what?
- Date: Sun, 04 May 2003 09:18:03 -0400
There are currently two removeChild methods in ParentNode:
public void removeChild(int position)
public void removeChild(Node child)
They both throw various exceptions if the child is not in fact a child of the parent node. I have an open item to decide whther void is the appropriate return type. Should one or both of these methods perhaps return the node removed? That is, should they be changed to:
public Node removeChild(int position)
public Node removeChild(Node child)
Note that this is *not* for method invocation chaining because what's returned is an argument or a previously unknown node, *not* the node from which the child was removed and which invoked removeChild.
I have at least one sample program for removeChild(int position) where this makes sense and would simplify my code.
I don't think this would break anybody's existing code. It would not make the API noticeably more complex. After all, it's easy to ignore the return value if you don't need it. Does this change offend anybody's sensibilities for any reason?
Second question: does it make sense for both methods to return the node removed? or just the one that removes by position? After all, when the method removes a specific child node, you must already have a reference to that node. Then again, it may be conceptually cleaner for both removeChild methods to return the same thing. Thoughts?
--
Elliotte
-
[XOM-interest] removeChild returns what?,
Elliotte Rusty Harold, 05/04/2003
- Re: [XOM-interest] removeChild returns what?, Elliotte Rusty Harold, 05/04/2003
- Re: [XOM-interest] removeChild returns what?, Bradley S. Huffman, 05/04/2003
- Re: [XOM-interest] removeChild returns what?, Laurent Bihanic, 05/05/2003
- Re: [XOM-interest] removeChild returns what?, Elliotte Rusty Harold, 05/05/2003
Archive powered by MHonArc 2.6.24.