Re: Exceptions in Attribues(2), AttributesImpl

Paul Brown <[email protected]> Sat, 15 Nov 2003 20:58:18 -0600
Newsgroups gmane.text.xml.sax.devel
Message-ID <[email protected]>
Hi, Karl --

> Is there any good reason I have overlooked why it should
> be the way it is?

The by-name getters are used for the purpose of testing for the 
presence of an attribute as much as getting its value, and something 
like this:

String s = atts.getValue("foo");
if (s != null) {
  doStuff(s);
}

is preferable to something like this:

if (isSet("foo")) {
   String s = atts.getValue("foo");
   doStuff(s);
}

If for nothing else, the former is more in the habit of Java 
programmers, but also it saves two traversals of the internal data 
structure.  (The same would be true for an implementation of Attributes 
backed by Collection APIs.)

My $0.02.

	-- Paul



-------------------------------------------------------
This SF. Net email is sponsored by: GoToMyPC
GoToMyPC is the fast, easy and secure way to access your computer from
any Web browser or wireless device. Click here to Try it Free!
https://www.gotomypc.com/tr/OSDN/AW/Q4_2003/t/g22lp?Target=mm/g22lp.tmpl
_______________________________________________
List: sax-devel, [email protected]
See:  http://www.saxproject.org/
https://lists.sourceforge.net/lists/listinfo/sax-devel