xom-interest AT lists.ibiblio.org
Subject: XOM API for Processing XML with Java
List archive
[XOM-interest] RFE: Element.appendChild(String text) should return "this" for chaining
- From: Wolfgang Hoschek <whoschek AT lbl.gov>
- To: xom-interest AT lists.ibiblio.org
- Subject: [XOM-interest] RFE: Element.appendChild(String text) should return "this" for chaining
- Date: Mon, 16 Aug 2004 11:09:02 -0700
RFE: Element.appendChild(String text) should return "this" for chaining.
Knowing that some people feel strongly against chaining I'm not promoting using chaining everywhere and inappropriately, but there is one place where it would be very practical, as it arises very frequently: Consider adding a couple of items with Text values to a list of items, as follows.
Element items = new Element("items");
Element item = new Element("item");
item.appendChild("car");
items.appendChild(item);
item = new Element("item");
item.appendChild("boat");
items.appendChild(item);
item = new Element("item");
item.appendChild("plane");
items.appendChild(item);
Do you immediately see what the code is about? Probably not.
If Element.appendChild(String text) would return this one could write this more understandably and consisely as follows.
Element items = new Element("items");
items.appendChild(new
Element("item").appendChild("car"));
items.appendChild(new
Element("item").appendChild("boat"));
items.appendChild(new
Element("item").appendChild("plane"));
The case occurs sufficiently often to consider it, IMHO.
Plus the change would be backwards compatible since the method currently returns void.
Wolfgang.
-
[XOM-interest] RFE: Element.appendChild(String text) should return "this" for chaining,
Wolfgang Hoschek, 08/16/2004
-
Re: [XOM-interest] RFE: Element.appendChild(String text) should return "this" for chaining,
Elliotte Rusty Harold, 08/16/2004
- Re: [XOM-interest] RFE: Element.appendChild(String text) should return "this" for chaining, Wolfgang Hoschek, 08/16/2004
-
Re: [XOM-interest] RFE: Element.appendChild(String text) should return "this" for chaining,
Stefan Matthias Aust, 08/17/2004
-
Re: [XOM-interest] RFE: Element.appendChild(String text) should return "this" for chaining,
Elliotte Rusty Harold, 08/17/2004
-
Re: [XOM-interest] RFE: Element.appendChild(String text) shouldreturn "this" for chaining,
passani, 08/17/2004
- Re: [XOM-interest] RFE: Element.appendChild(String text) shouldreturn "this" for chaining, Stefan Matthias Aust, 08/17/2004
- Re: [XOM-interest] RFE: Element.appendChild(String text) shouldreturn "this" for chaining, John Cowan, 08/17/2004
-
Re: [XOM-interest] RFE: Element.appendChild(String text) shouldreturn "this" for chaining,
passani, 08/17/2004
-
Re: [XOM-interest] RFE: Element.appendChild(String text) should return "this" for chaining,
Elliotte Rusty Harold, 08/17/2004
-
Re: [XOM-interest] RFE: Element.appendChild(String text) should return "this" for chaining,
Elliotte Rusty Harold, 08/16/2004
Archive powered by MHonArc 2.6.24.