Don't you already have ties to one (or both) of Xerces and/or Sun? What's the complication in adding a single method that creates a Attributes instance and populates it with the information from the AttributeList class? Stick to the interface as much as possible and only use AttributesImpl to create the initial Attributes instance.
Brion Swanson -----Original Message----- From: Jason Rizer [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 19, 2001 12:17 PM To: [EMAIL PROTECTED] Subject: Is there any implementation nuetral way to create an Attributes? Hello. I have an SAX Parsing application which I'm trying to get to work with both xerces and the sun parser which comes with jaxp1.01. The problem is that the sun parser is an SAX1 implementation. As a result the class which handles the call back methods must implement both DocumentHandler (SAX1) and ContentHandler (SAX2). This isn't so bad really except that I've run into a problem with startElement( ). The signatures differ in the two interfaces so I've got to implement both versions which are: startElement(String, org.xml.sax.AttributeList) - SAX2 startElement(String, String, String, org.xml.sax.Attributes) - SAX2 My application doesn't care about the extra SAX2 parameters so I don't have a logical problem. I've currently got things working by including all of the same code in each version of startElement( ), but all of this code duplication is not very appealing to say the least. I'd like to do something like this: public void startElement(String name, AttributeList atts) { // delegate this to the SAX2 version startElement( (String) null, (String) null, name, atts); } but the problem is the AttributeList, Attributes mismatch. If I could find an implmentation nuetral way to instantiate an object which implements Attributes I could go attribute by attribute and convert my AttributeList to an Attributes and then I could call the SAX2 version of startElement( ) and save myself the code duplication. I apologize for the long-winded post. Thanks in advance for any suggestions. -Jason __________________________________________________ Do You Yahoo!? Spot the hottest trends in music, movies, and more. http://buzz.yahoo.com/ --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
