[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

SAX: Parser Factory class

  • From: "Andrew n marshall" <amarshal@u...>
  • To: "Xml-Dev List" <xml-dev@i...>
  • Date: Thu, 16 Apr 1998 07:48:19 -0700

sax parser factory
While it is great that there are so many SAX parsers available, the thing that bothers me is that my application has to know what Parser to load in just to use SAX.  And  this means that even is a SAX parser is available on the users machine, they may still have to download the one I use to to run my application.
 
If there is already a solution for this, then please let me know.
 
David Megginson had mentioned the sax.parser property as a possible solution, but I would like to see the following my general solution:
 
public class org.sax.ParserFactory() {
   /* static methods */
   // Registers a SAX driver
   public static void addParserFactory();
   // Retrieves all registered SAX drivers
   public static ParserFactory[] getParserFactorys();
   // Conveince method to return a parser
   // from the first registered driver
   public static Parser createDefaultParser();
   /* Instance Methods */
   // Returns a new Parser
   public Parser createParser();
   // Various identifying methods
   // Subject to change for what appropriate method
   abstract public String getDriverName();
   abstract public long getDriverVersion();
   abstract public long getSAXVersion();
}

If the above was implemented, then the following piece of code in the ParserFactory implementation could automatically register the SAX Driver.

   static {
      org.sax.ParserFactory.addParserFactory( new MyParserFactory() );
   }

 

I think this is a relative clean and forward compatible way to handle SAX Drivers.  And simplifies life for SAX based application programmers.  I realize it is a bit heavy weight since it require that the Factory be an abstract class instead of an interface, but I think the benefit is worth it.

Any thoughts?

 

Andrew n marshall
  student - artist - programmer
    http://www.media-electronica.com/anm-bin/anm
      "Everyone a mentor, Everyone a pupil"

 

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.