Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] XOM 1.0d23 Last Call

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: jcowan AT reutershealth.com
  • To: Elliotte Rusty Harold <elharo AT metalab.unc.edu>
  • Cc: xom-interest AT lists.ibiblio.org
  • Subject: Re: [XOM-interest] XOM 1.0d23 Last Call
  • Date: Mon, 2 Feb 2004 18:06:11 -0500

Elliotte Rusty Harold scripsit:

> >1) I think it's worth having a Nodes.put method to complement get. The
> >only
> > 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.

> I think alpha and beta have been seriously debased in the last
> fifteen years or so, and I'm trying to fight back. :-) To my way of
> thinking alpha 1 is feature complete. Beta 1 is free of all known
> bugs, and the release candidate has all documents and supporting
> material in place.

Okay.

--
John Cowan jcowan AT reutershealth.com
http://www.reutershealth.com http://www.ccil.org/~cowan
Humpty Dump Dublin squeaks through his norse
Humpty Dump Dublin hath a horrible vorse
But for all his kinks English / And his irismanx brogues
Humpty Dump Dublin's grandada of all rogues. --Cousin James




Archive powered by MHonArc 2.6.24.

Top of Page