xom-interest AT lists.ibiblio.org
Subject: XOM API for Processing XML with Java
List archive
- From: dirk bergstrom <dirk AT juniper.net>
- To: xom-interest AT lists.ibiblio.org
- Subject: [XOM-interest] an "isA" method in Element
- Date: Tue, 18 Feb 2003 19:44:21 -0800
i saw this in ExampleLister.java:
// Does this call for an isA method in Element?
// i.e. is such and such in tcertain namespace?
// or is it better to do this as part of a generic traversal
// API???? or a utility class
if (root.getLocalName().equals("chapter")) {
after a couple days of XOM coding, i'm all for having an isA method in
Element.
i've got a slew of code like this:
String elemName = element.getLocalName();
if (elemName.equals(mumble)) {
// foo
} else if (elemName.equals(frotz)) {
// baz
} else...
and it would be nice to have an isA method to clean that up.
i know elharo is opposed to trivial convenience methods, but i think this
would make for better looking code. the desire for it will come up
repeatedly, given the "iterate over elements" pattern of XOM coding.
my fractional cent of opinion...
--
Dirk Bergstrom dirk AT juniper.net
_____________________________________________
Juniper Networks Inc., Computer Geek
Tel: 408.745.3182 Fax: 408.745.8905
- [XOM-interest] an "isA" method in Element, dirk bergstrom, 02/18/2003
Archive powered by MHonArc 2.6.24.