OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: ANN: SAX 2.0 extension proposals.

[ Lists Home | Date Index | Thread Index ]
  • From: David Brownell <david-b@pacbell.net>
  • To: David Megginson <david@megginson.com>
  • Date: Wed, 23 Feb 2000 13:53:24 -0800

David Megginson wrote:
> 
> For the SAX core, I'm leaning towards a rewrite of the SAX1
> ParserFactory into XMLReaderFactory, only with methods that throw
> SAXException (as David B. suggested).  It will look like this:

Naturally I don't have too much objection to this, though I'd like
to see the standard factory naming convention (createX, not makeX).

However, I do wonder what you think about the fact that this will
need to run in environments where calls like System.getProperty()
aren't allowed, or which may not support dynamic loading.

It's been my thought that the "agreed on" spec needs to say that
the implementation of these methods is not standardized, though
the effect is ... and quite specifically that the system property
might be ignored in some environments when determining a default.

- Dave



> ====================8<====================8<====================
>   package org.xml.sax.helpers;
>   import org.xml.sax.SAXException;
>   import org.xml.sax.XMLReader;
> 
>   final public class XMLReaderFactory
>   {
> 
>       private XMLReaderFactory ()
>       {
>       }
> 
>       public static XMLReader makeXMLReader ()
>           throws SAXException
>       {
>           String className = System.getProperty("org.xml.sax.driver");
>           if (className == null) {
>               throw new
>                   SAXException("System property org.xml.sax.driver not specified");
>           } else {
>               return makeXMLReader(className);
>           }
>       }
> 
>       public static XMLReader makeXMLReader (String className)
>           throws SAXException
>       {
>           try {
>               return (XMLReader)(Class.forName(className).newInstance());
>           } catch (ClassNotFoundException e1) {
>               throw new SAXException("SAX2 driver class " + className +
>                                      " not found", e1);
>           } catch (IllegalAccessException e2) {
>               throw new SAXException("SAX2 driver class " + className +
>                                      " found but cannot be loaded", e2);
>           } catch (InstantiationException e3) {
>               throw new SAXException("SAX2 driver class " + className +
>                                      " loaded but cannot be instantiated (no empty public constructor?)",
>                                      e3);
>           } catch (ClassCastException e4) {
>               throw new SAXException("SAX2 driver class " + className +
>                                      " does not implement XMLReader", e4);
>           }
> 
>       }
> 
>   }

***************************************************************************
This is xml-dev, the mailing list for XML developers.
To unsubscribe, mailto:majordomo@xml.org&BODY=unsubscribe%20xml-dev
List archives are available at http://xml.org/archives/xml-dev/threads.html
***************************************************************************




 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS