xom-interest AT lists.ibiblio.org
Subject: XOM API for Processing XML with Java
List archive
- From: "Bradley S. Huffman" <hip AT cs.okstate.edu>
- To: jcowan AT reutershealth.com
- Cc: xom-interest AT lists.ibiblio.org
- Subject: Re: [XOM-interest] XOM 1.0d23 Last Call
- Date: Mon, 02 Feb 2004 18:13:24 -0600
Is this just a variation of replaceChild(Node old, Node new) in ParentNode?
Brad
jcowan AT reutershealth.com writes:
> Elliotte Rusty Harold scripsit:
>
> > >1) I think it's worth having a Nodes.put method to complement get. The
> > >on
> ly
> > > way to replace a single Node in the list currently is either to copy
> > > it, which does not preserve object identity, or else to remove and
> > > then insert/append, which involves copying the list anywhere up to
> > > twice internally (if you want to replace the zeroth node), and
> > > requires
> > > getting the insert vs. append choice correct.
> >
> > I'm sorry. I don't think I understand your proposal here. What would
> > be the signature of this method, and what would its behavior be?
>
> Conceptually, it looks like this:
>
> public void put(Node node, int index) {
> if (index < 0 || index >= node.size()) {
> throw new IndexOutOfBoundsException("whatever");
> }
> else if (index == node.size()) {
> remove(index);
> append(node);
> }
> else {
> remove(index);
> insert(node, index);
> }
>
> Of course, you don't implement it that way, because that will involve
> copying
> the nodes around in order to do the remove/insert pair. Instead, you
> just replace the index'th entry of the internal array or whatever.
> The same story applies to Element.putAttribute and element.putChild;
> they conceptually remove and insert the index'th attribute or child,
> but in fact just replace.
-
[XOM-interest] XOM 1.0d23 Last Call,
Elliotte Rusty Harold, 02/02/2004
-
Re: [XOM-interest] XOM 1.0d23 Last Call,
jcowan, 02/02/2004
- Re: [XOM-interest] XOM 1.0d23 Last Call, dirk bergstrom, 02/02/2004
-
Re: [XOM-interest] XOM 1.0d23 Last Call,
Elliotte Rusty Harold, 02/02/2004
-
Re: [XOM-interest] XOM 1.0d23 Last Call,
jcowan, 02/02/2004
-
Re: [XOM-interest] XOM 1.0d23 Last Call,
Elliotte Rusty Harold, 02/02/2004
- Re: [XOM-interest] XOM 1.0d23 Last Call, John Cowan, 02/02/2004
-
Re: [XOM-interest] XOM 1.0d23 Last Call,
Bradley S. Huffman, 02/02/2004
-
Re: [XOM-interest] XOM 1.0d23 Last Call,
John Cowan, 02/02/2004
- Re: [XOM-interest] XOM 1.0d23 Last Call, Bradley S. Huffman, 02/02/2004
-
Re: [XOM-interest] XOM 1.0d23 Last Call,
John Cowan, 02/02/2004
-
Re: [XOM-interest] XOM 1.0d23 Last Call,
Elliotte Rusty Harold, 02/02/2004
-
Re: [XOM-interest] XOM 1.0d23 Last Call,
jcowan, 02/02/2004
- Re: [XOM-interest] XOM 1.0d23 Last Call, Bill de hÓra, 02/02/2004
-
[XOM-interest] Put methods,
Elliotte Rusty Harold, 02/05/2004
- Re: [XOM-interest] Put methods, jcowan, 02/05/2004
-
[XOM-interest] hasChildren vs. getChildCount == 0,
Elliotte Rusty Harold, 02/05/2004
-
Re: [XOM-interest] hasChildren vs. getChildCount == 0,
Dirk Bergstrom, 02/05/2004
- Re: [XOM-interest] hasChildren vs. getChildCount == 0, Bill de hÓra, 02/05/2004
- Re: [XOM-interest] hasChildren vs. getChildCount == 0, Janek Bogucki, 02/09/2004
-
Re: [XOM-interest] hasChildren vs. getChildCount == 0,
Dirk Bergstrom, 02/05/2004
- [XOM-interest] UNDECLARED vs. CDATA, Elliotte Rusty Harold, 02/05/2004
-
Re: [XOM-interest] XOM 1.0d23 Last Call,
jcowan, 02/02/2004
Archive powered by MHonArc 2.6.24.