Handling of addAttribute(null, ...)

Jochen Wiedmann <[email protected]> Mon, 12 Apr 2004 19:01:33 +0200
Newsgroups gmane.text.xml.sax.devel
Message-ID <[email protected]>
Hi,

by reading the SAX sources, I come to the conclusion, that the empty string
("") is supposed for the default namespace. In other words, I must not use
something like

     AttributesImpl a;
     a.addAttribute(null, "value", "value", "CDATA", "");

(Probably the same holds true for ContentHandler.startElement() and
ContentHandler.endElement().) Fine for me.

However, if I do the above anyways, then I will receive an NPE in

     AttributesImpl.getValue(String, String)

regardless of the input. This is quite nasty, because the problems actual
source is elsewhere.

For that reason, I suggest adding checks for null to
AttributesImpl.addAttribute(). IMO this would enhance the libraries usability.


Regards,

Jochen







-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
List: sax-devel, [email protected]
See:  http://www.saxproject.org/
https://lists.sourceforge.net/lists/listinfo/sax-devel