You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by pi...@locus.apache.org on 2000/02/26 06:56:32 UTC

cvs commit: xml-xerces/java/src/javax/xml/parsers DocumentBuilder.java DocumentBuilderFactory.java FactoryConfigurationError.java package.html ParserConfigurationException.java SAXParser.java SAXParserFactory.java

pier        00/02/25 21:56:32

  Added:       java/src/javax/xml/parsers DocumentBuilder.java
                        DocumentBuilderFactory.java
                        FactoryConfigurationError.java package.html
                        ParserConfigurationException.java SAXParser.java
                        SAXParserFactory.java
  Log:
  The javax.xml.parsers package as specified by the "Java API for XML Parsers".
  This is not (C) Apache, because, since it's a javax package implementation,
  if something arises, I don't want the ASF to be blamed for it.
  
  Revision  Changes    Path
  1.1                  xml-xerces/java/src/javax/xml/parsers/DocumentBuilder.java
  
  Index: DocumentBuilder.java
  ===================================================================
  /******************************************************************************
   * Copyright (C) 1999-2000, Pierpaolo Fumagalli <ma...@betaversion.org> *
   *                                                                            *
   * Redistribution and use in source  and/or in binary forms,  with or without *
   * modification are hereby permitted provided that the above copyright notice *
   * the following disclaimers, and this paragraph are not altered.             *
   *                                                                            *
   * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, *
   * INCLUDING,  BUT NOT LIMITED TO,  THE IMPLIED WARRANTIES OF MERCHANTABILITY *
   * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE *
   * AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, *
   * OR CONSEQUENTIAL DAMAGES  (INCLUDING,  BUT NOT LIMITED TO,  PROCUREMENT OF *
   * SUBSTITUTE GOODS OR SERVICES;  LOSS OF USE, DATA, OR PROFITS;  OR BUSINESS *
   * INTERRUPTION)  HOWEVER CAUSED AND ON  ANY THEORY OF LIABILITY,  WHETHER IN *
   * CONTRACT,  STRICT LIABILITY,  OR TORT  (INCLUDING NEGLIGENCE OR OTHERWISE) *
   * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE *
   * POSSIBILITY OF SUCH DAMAGE.                                                *
   *                                                                            *
   * ATTENTION:                                                                 *
   *     THIS  IMPLEMENTATION  OF THE  "JAVAX.XML.PARSER"  CLASSES IS  PROVIDED *
   *     FOR  EXPERIMENTAL PURPOSES  ONLY  AND IS  NOT THE  OFFICIAL  REFERENCE *
   *     IMPLEMENTATION OF THE JAVA SPECIFICATION REQUEST 5 FOUND AT:           *
   *     <http://java.sun.com/aboutJava/communityprocess/jsr/jsr_005_xml.html>  *
   *                                                                            *
   *     THIS IMPLEMENTATION  IS CONFORMANT  TO THE  "JAVA API FOR XML PARSING" *
   *     SPECIFICATION  VERSION 1.0  PUBLIC RELEASE 1  BY JAMES DUNCAN DAVIDSON *
   *     ET AL. PUBLISHED BY SUN MICROSYSTEMS ON FEB. 18, 2000 AND FOUND AT:    *
   *     <http://java.sun.com/xml>                                              *
   ******************************************************************************/
  package javax.xml.parsers;
  
  import java.io.File;
  import java.io.InputStream;
  import java.io.IOException;
  import org.xml.sax.EntityResolver;
  import org.xml.sax.ErrorHandler;
  import org.xml.sax.InputSource;
  import org.xml.sax.SAXException;
  import org.w3c.dom.Document;
  
  /**
   * Instances of <code>DocumentBuilder</code> provide a mechansim for
   * parsing XML documents into a DOM document tree represented by an
   * <code>org.w3c.dom.Document</code> object.
   * <br>
   * A <code>DocumentBuilder</code> instance is obtained from a
   * <code>DocumentBuilderFactory</code> by invoking its
   * <code>newDocumentBuilder()</code> method.
   * <br>
   * <b>NOTE:</b> <code>DocumentBuilder</code> uses several classes from the
   *     SAX API. This does not require that the implementor of the
   *     underlying DOM implementation use a SAX parser to parse XML content
   *     into a <code>org.w3c.dom.Document</code>. It merely requires that
   *     the implementation communicate with the application using these
   *     existing APIs.
   * <br>
   * <br>
   * <b>ATTENTION:</b> THIS IMPLEMENTATION OF THE "JAVAX.XML.PARSER" CLASSES
   *   IS PROVIDED FOR EXPERIMENTAL PURPOSES ONLY AND IS NOT THE OFFICIAL
   *   REFERENCE IMPLEMENTATION OF THE JAVA SPECIFICATION REQUEST 5 FOUND AT
   *   <a href="http://java.sun.com/aboutJava/communityprocess/jsr/jsr_005_xml.html">
   *   http://java.sun.com/aboutJava/communityprocess/jsr/jsr_005_xml.html
   *   </a><br>
   *   THIS IMPLEMENTATION IS CONFORMANT TO THE "JAVA API FOR XML PARSING"
   *   SPECIFICATION VERSION 1.0 PUBLIC RELEASE 1 BY JAMES DUNCAN DAVIDSON
   *   PUBLISHED BY SUN MICROSYSTEMS ON FEB. 18, 2000 AND FOUND AT
   *   <a href="http://java.sun.com/xml">http://java.sun.com/xml</a>
   * <br>
   * <br>
   * <b>THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
   * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
   * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
   * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
   * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
   * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
   * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
   * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   *
   * @author <a href="pier@betaversion.org">Pierpaolo Fumagalli</a>
   * @author Copyright &copy; 1999-2000, Pierpaolo Fumagalli
   *         <a href="mailto:pier@betaversion.org">pier@betaversion.org</a>
   * @version 1.0 CVS $Revision: 1.1 $ $Date: 2000/02/26 05:56:30 $
   */
  public abstract class DocumentBuilder {
  
      /**
       * Implementors of this abstract class are not required to provide a
       * public no-argument constructor, since instantiation is taken care
       * by <code>DocumentBuilderFactory</code> implementations.
       */
      protected DocumentBuilder() {
          super();
      }
  
      /**
       * Parses the contents of the given <code>InputStream</code> and returns
       * a <code>Document</code> object.
       *
       * @exception SAXException If there is a problem parsing the given XML
       *                content.
       * @exception IOException If any IO errors occur reading the given
       *                <code>InputStream</code>.
       * @exception  IllegalArgumentException If the given
       *                <code>InputStream</code> is <b>null</b>.
       */
      public Document parse(InputStream stream)
      throws SAXException, IOException, IllegalArgumentException {
          if (stream==null) throw new IllegalArgumentException();
          return(this.parse(new InputSource(stream)));
      }
  
      /**
       * Parses the content of the given URI and returns a <code>Document</code>
       * object.
       *
       * @exception SAXException If there is a problem parsing the given XML
       *                content.
       * @exception IOException If any IO errors occur while reading content
       *                located by the given URI.
       * @exception IllegalArgumentException If the given URI is <b>null</b>.
       */
      public Document parse(String uri)
      throws SAXException, IOException, IllegalArgumentException {
          if (uri==null) throw new IllegalArgumentException();
          return(this.parse(new InputSource(uri)));
      }
  
      /**
       * Parses the content of the given <code>File</code> and returns a
       * <code>Document</code> object.
       *
       * @exception SAXException If there is a problem parsing the given XML
       *                content.
       * @exception IOException if any IO errors occur while reading content
       *                from the given <code>File</code>.
       * @exception IllegalArgumentException if the given <code>File</code> is
       *                <b>null</b>.
       */
      public Document parse(File file)
      throws SAXException, IOException, IllegalArgumentException {
          if (file==null) throw new IllegalArgumentException();
          return(this.parse(new InputSource(file.getName())));
      }
  
      /**
       * Parses the content of the given <code>InputSource</code> and returns
       * a <code>Document</code> object.
       *
       * @exception SAXException If there is a problem parsing the given XML
       *                content.
       * @exception IOException if any IO Errors occur while reading content
       *                from the given <code>InputSource</code>.
       * @exception IllegalArgumentException if the given
       *                <code>InputSource</code> is <b>null</b>.
       */
      public abstract Document parse(InputSource source)
      throws SAXException, IOException, IllegalArgumentException;
  
      /**
       * Creates an new <code>Document</code> instance from the underlying DOM
       * implementation.
       */
      public abstract Document newDocument();
  
      /**
       * Returns whether or not this parser supports XML namespaces.
       */
      public abstract boolean isNamespaceAware();
  
      /**
       * Returns whether or not this parser supports validating XML content.
       */
      public abstract boolean isValidating();
  
      /**
       * Specifies the <code>EntityResolver</code> to be used by this
       * <code>DocumentBuilder</code>.
       * <br>
       * Setting the <code>EntityResolver</code> to <b>null</b>, or not
       * calling this method, will cause the underlying implementation to
       * use its own default implementation and behavior.
       */
      public abstract void setEntityResolver(EntityResolver er);
  
      /**
       * Specifies the <code>ErrorHandler</code> to be used by this
       * <code>DocumentBuilder</code>.
       *
       * Setting the <code>ErrorHandler</code> to <b>null</b>, or not
       * calling this method, will cause the underlying implementation to
       * use its own default implementation and behavior.
       */
      public abstract void setErrorHandler(ErrorHandler eh);
  }
  
  
  
  
  1.1                  xml-xerces/java/src/javax/xml/parsers/DocumentBuilderFactory.java
  
  Index: DocumentBuilderFactory.java
  ===================================================================
  /******************************************************************************
   * Copyright (C) 1999-2000, Pierpaolo Fumagalli <ma...@betaversion.org> *
   *                                                                            *
   * Redistribution and use in source  and/or in binary forms,  with or without *
   * modification are hereby permitted provided that the above copyright notice *
   * the following disclaimers, and this paragraph are not altered.             *
   *                                                                            *
   * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, *
   * INCLUDING,  BUT NOT LIMITED TO,  THE IMPLIED WARRANTIES OF MERCHANTABILITY *
   * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE *
   * AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, *
   * OR CONSEQUENTIAL DAMAGES  (INCLUDING,  BUT NOT LIMITED TO,  PROCUREMENT OF *
   * SUBSTITUTE GOODS OR SERVICES;  LOSS OF USE, DATA, OR PROFITS;  OR BUSINESS *
   * INTERRUPTION)  HOWEVER CAUSED AND ON  ANY THEORY OF LIABILITY,  WHETHER IN *
   * CONTRACT,  STRICT LIABILITY,  OR TORT  (INCLUDING NEGLIGENCE OR OTHERWISE) *
   * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE *
   * POSSIBILITY OF SUCH DAMAGE.                                                *
   *                                                                            *
   * ATTENTION:                                                                 *
   *     THIS  IMPLEMENTATION  OF THE  "JAVAX.XML.PARSER"  CLASSES IS  PROVIDED *
   *     FOR  EXPERIMENTAL PURPOSES  ONLY  AND IS  NOT THE  OFFICIAL  REFERENCE *
   *     IMPLEMENTATION OF THE JAVA SPECIFICATION REQUEST 5 FOUND AT:           *
   *     <http://java.sun.com/aboutJava/communityprocess/jsr/jsr_005_xml.html>  *
   *                                                                            *
   *     THIS IMPLEMENTATION  IS CONFORMANT  TO THE  "JAVA API FOR XML PARSING" *
   *     SPECIFICATION  VERSION 1.0  PUBLIC RELEASE 1  BY JAMES DUNCAN DAVIDSON *
   *     ET AL. PUBLISHED BY SUN MICROSYSTEMS ON FEB. 18, 2000 AND FOUND AT:    *
   *     <http://java.sun.com/xml>                                              *
   ******************************************************************************/
  package javax.xml.parsers;
  
  /**
   * The <code>DocumentBuilderFactory</code> defines a factory API that enables
   * applications to configure and obtain a parser to parse XML documents into
   * a DOM Document tree.
   * <br>
   * <br>
   * <b>ATTENTION:</b> THIS IMPLEMENTATION OF THE "JAVAX.XML.PARSER" CLASSES
   *   IS PROVIDED FOR EXPERIMENTAL PURPOSES ONLY AND IS NOT THE OFFICIAL
   *   REFERENCE IMPLEMENTATION OF THE JAVA SPECIFICATION REQUEST 5 FOUND AT
   *   <a href="http://java.sun.com/aboutJava/communityprocess/jsr/jsr_005_xml.html">
   *   http://java.sun.com/aboutJava/communityprocess/jsr/jsr_005_xml.html
   *   </a><br>
   *   THIS IMPLEMENTATION IS CONFORMANT TO THE "JAVA API FOR XML PARSING"
   *   SPECIFICATION VERSION 1.0 PUBLIC RELEASE 1 BY JAMES DUNCAN DAVIDSON
   *   PUBLISHED BY SUN MICROSYSTEMS ON FEB. 18, 2000 AND FOUND AT
   *   <a href="http://java.sun.com/xml">http://java.sun.com/xml</a>
   * <br>
   * <br>
   * <b>THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
   * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
   * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
   * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
   * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
   * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
   * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
   * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   *
   * @author <a href="pier@betaversion.org">Pierpaolo Fumagalli</a>
   * @author Copyright &copy; 1999-2000, Pierpaolo Fumagalli
   *         <a href="mailto:pier@betaversion.org">pier@betaversion.org</a>
   * @version 1.0 CVS $Revision: 1.1 $ $Date: 2000/02/26 05:56:30 $
   */
  public abstract class DocumentBuilderFactory {
  
      /** Wether the DocumentBuilder to be generated must support namespaces. */
      private boolean namespaces=false;
      /** Wether the DocumentBuilder to be generated must support validataion. */
      private boolean validation=false;
      /** The system property to check for DocumentBuilderFactory class name. */
      private static String property="javax.xml.parsers.DocumentBuilderFactory";
      /** The default DocumentBuilderFactory implementation class name. */
      private static String factory=
                            "org.apache.xerces.jaxp.DocumentBuilderFactoryImpl";
  
      /**
       * Implementors of this abstract class <b>must</b> provide their own
       * public no-argument constructor in order for the static
       * <code>newInstance()</code> method to work correctly.
       * <br>
       * Application programmers should be able to instantiate an implementation
       * of this abstract class directly if they want to use a specfic
       * implementation of this API without using the static newInstance method
       * to obtain the configured or platform default implementation.
       */
      protected DocumentBuilderFactory() {
          super();
      }
  
      /**
       *
       * Returns a new instance of a <code>DocumentBuilderFactory</code>.
       * <br>
       * The implementation of the <code>DocumentBuilderFactory</code>
       * returned depends on the setting of the
       * <code>javax.xml.parsers.DocumentBuilderFactory</code> property or,
       * if the property is not set, a platform specific default.
       *
       * @exception FactoryConfigurationError If the class implementing the
       *                factory cannot be found or instantiated.
       *                An <code>Error</code> is thrown instead of an exception
       *                because the application is not expected to handle or
       *                recover from such events.
       */
      public static DocumentBuilderFactory newInstance() {
  
          // Evaluate wether we have to use or Class.forName() for JDK 1.1 or
          // Thread.currentThread().getContextClassLoader().loadClass() for
          // the new JDK 1.2
          boolean newPlatform=true;
          try {
              new ThreadLocal();
          } catch (NoClassDefFoundError t) {
              newPlatform=false;
          }
  
          // Retrieve the javax.xml.parsers.DocumentBuilderFactory system property
          String n=System.getProperty(property, factory);
  
          try {
              // Attempt to load the factory class.
              Class c=null;
              if (!newPlatform) c=Class.forName(n);
              else c=Thread.currentThread().getContextClassLoader().loadClass(n);
  
              // Attempt to instantiate and return the factory class
              return (DocumentBuilderFactory)c.newInstance();
  
          } catch (ClassNotFoundException e) {
              // The factory class was not found
              throw new FactoryConfigurationError("Cannot load class "+
                  "DocumentBuilderFactory class \""+n+"\"");
  
          } catch (InstantiationException e) {
              // The factory class wasn't instantiated
              throw new FactoryConfigurationError("Cannot instantiate the "+
                  "specified DocumentBuilderFactory class \""+n+"\"");
  
          } catch (IllegalAccessException e) {
              // The factory class couldn't have been accessed
              throw new FactoryConfigurationError("Cannot access the specified "+
                  "DocumentBuilderFactory class \""+n+"\"");
  
          } catch (ClassCastException e) {
              // The factory class was not a DocumentBuilderFactory
              throw new FactoryConfigurationError("The specified class \""+n+
                  "\" is not instance of \""+
                  "javax.xml.parsers.DocumentBuilderFactory\"");
          }
      }
  
      /**
       * Returns a new configured instance of type <code>DocumentBuilder</code>.
       *
       * @exception ParserConfigurationException If the
       *                <code>DocumentBuilder</code> instance cannot be created
       *                with the requested configuration.
       */
      public abstract DocumentBuilder newDocumentBuilder()
      throws ParserConfigurationException;
  
      /**
       * Configuration method that specifies whether the parsers created by this
       * factory are required to provide XML namespace support or not.
       * <br>
       * <b>NOTE:</b> if a parser cannot be created by this factory that
       *     satisfies the requested namespace awareness value, a
       *     <code>ParserConfigurationException</code> will be thrown when the
       *     program attempts to aquire the parser calling the
       *     <code>newDocumentBuilder()</code> method.
       */
      public void setNamespaceAware(boolean aware) {
          this.namespaces=aware;
      }
  
      /**
       * Configuration method whether specifies if the parsers created by this
       * factory are required to validate the XML documents that they parse.
       * <br>
       * <b>NOTE:</b> if a parser cannot be created by this factory that
       *     satisfies the requested validation capacity, a
       *     <code>ParserConfigurationException</code> will be thrown when
       *     the application attempts to aquire the parser via the
       *     <code>newDocumentBuilder()</code> method.
       */
      public void setValidating(boolean validating) {
          this.validation=validating;
      }
  
      /**
       * Indicates if this <code>DocumentBuilderFactory</code> is configured to
       * produce parsers that are namespace aware or not.
       */
      public boolean isNamespaceAware() {
          return(this.namespaces);
      }
  
      /**
       * Indicates if this <code>DocumentBuilderFactory</code> is configured to
       * produce parsers that validate XML documents as they are parsed.
       */
      public boolean isValidating() {
          return(this.validation);
      }
  }
  
  
  
  1.1                  xml-xerces/java/src/javax/xml/parsers/FactoryConfigurationError.java
  
  Index: FactoryConfigurationError.java
  ===================================================================
  /******************************************************************************
   * Copyright (C) 1999-2000, Pierpaolo Fumagalli <ma...@betaversion.org> *
   *                                                                            *
   * Redistribution and use in source  and/or in binary forms,  with or without *
   * modification are hereby permitted provided that the above copyright notice *
   * the following disclaimers, and this paragraph are not altered.             *
   *                                                                            *
   * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, *
   * INCLUDING,  BUT NOT LIMITED TO,  THE IMPLIED WARRANTIES OF MERCHANTABILITY *
   * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE *
   * AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, *
   * OR CONSEQUENTIAL DAMAGES  (INCLUDING,  BUT NOT LIMITED TO,  PROCUREMENT OF *
   * SUBSTITUTE GOODS OR SERVICES;  LOSS OF USE, DATA, OR PROFITS;  OR BUSINESS *
   * INTERRUPTION)  HOWEVER CAUSED AND ON  ANY THEORY OF LIABILITY,  WHETHER IN *
   * CONTRACT,  STRICT LIABILITY,  OR TORT  (INCLUDING NEGLIGENCE OR OTHERWISE) *
   * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE *
   * POSSIBILITY OF SUCH DAMAGE.                                                *
   *                                                                            *
   * ATTENTION:                                                                 *
   *     THIS  IMPLEMENTATION  OF THE  "JAVAX.XML.PARSER"  CLASSES IS  PROVIDED *
   *     FOR  EXPERIMENTAL PURPOSES  ONLY  AND IS  NOT THE  OFFICIAL  REFERENCE *
   *     IMPLEMENTATION OF THE JAVA SPECIFICATION REQUEST 5 FOUND AT:           *
   *     <http://java.sun.com/aboutJava/communityprocess/jsr/jsr_005_xml.html>  *
   *                                                                            *
   *     THIS IMPLEMENTATION  IS CONFORMANT  TO THE  "JAVA API FOR XML PARSING" *
   *     SPECIFICATION  VERSION 1.0  PUBLIC RELEASE 1  BY JAMES DUNCAN DAVIDSON *
   *     ET AL. PUBLISHED BY SUN MICROSYSTEMS ON FEB. 18, 2000 AND FOUND AT:    *
   *     <http://java.sun.com/xml>                                              *
   ******************************************************************************/
  package javax.xml.parsers;
  
  /**
   * This error is thrown if there is a configuration problem when creating
   * new factory instances.
   * <br>
   * This error will also be thrown when the class of a Factory specified by
   * a system property, or the class of the default system parser factory,
   * cannot be loaded or instantiated.
   * <br>
   * Implementation or Application developers should never need to directly
   * construct or catch errors of this type.
   * <br>
   * <br>
   * <b>ATTENTION:</b> THIS IMPLEMENTATION OF THE "JAVAX.XML.PARSER" CLASSES
   *   IS PROVIDED FOR EXPERIMENTAL PURPOSES ONLY AND IS NOT THE OFFICIAL
   *   REFERENCE IMPLEMENTATION OF THE JAVA SPECIFICATION REQUEST 5 FOUND AT
   *   <a href="http://java.sun.com/aboutJava/communityprocess/jsr/jsr_005_xml.html">
   *   http://java.sun.com/aboutJava/communityprocess/jsr/jsr_005_xml.html
   *   </a><br>
   *   THIS IMPLEMENTATION IS CONFORMANT TO THE "JAVA API FOR XML PARSING"
   *   SPECIFICATION VERSION 1.0 PUBLIC RELEASE 1 BY JAMES DUNCAN DAVIDSON
   *   PUBLISHED BY SUN MICROSYSTEMS ON FEB. 18, 2000 AND FOUND AT
   *   <a href="http://java.sun.com/xml">http://java.sun.com/xml</a>
   * <br>
   * <br>
   * <b>THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
   * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
   * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
   * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
   * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
   * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
   * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
   * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   *
   * @author <a href="pier@betaversion.org">Pierpaolo Fumagalli</a>
   * @author Copyright &copy; 1999-2000, Pierpaolo Fumagalli
   *         <a href="mailto:pier@betaversion.org">pier@betaversion.org</a>
   * @version 1.0 CVS $Revision: 1.1 $ $Date: 2000/02/26 05:56:30 $
   */
  public class FactoryConfigurationError extends Error {
  
      /** The root cause of this <code>FactoryConfigurationError</code>. */
      private Exception exception=null;
  
      /**
       * Constructs a new <code>FactoryConfigurationError</code> with no
       * detail message.
       */
      public FactoryConfigurationError() {
          this(null,null);
      }
  
      /**
       * Constructs a new <code>FactoryConfigurationError</code> with the
       * given detail message.
       */
      public FactoryConfigurationError(String msg) {
          this(null,msg);
      }
  
      /**
       * Constructs a new <code>FactoryConfigurationError</code> with the
       * given <code>Exception</code> as a root cause.
       */
      public FactoryConfigurationError(Exception e) {
          this(e,null);
      }
  
      /**
       * Constructs a new <code>FactoryConfigurationError</code> with the
       * given <code>Exception</code> as a root cause and the given detail
       * message.
       */
      public FactoryConfigurationError(Exception e, String msg) {
          super(msg);
          this.exception=e;
      }
  
      /**
       * Returns the root cause of this <code>FactoryConfigurationError</code>
       * or <b>null</b> if there is none.
       */
      public Exception getException() {
          return(this.exception);
      }
  }
  
  
  
  1.1                  xml-xerces/java/src/javax/xml/parsers/package.html
  
  Index: package.html
  ===================================================================
  <!-- CVS $Revision: 1.1 $ $Date: 2000/02/26 05:56:30 $ -->
  <html>
   <body>
    This package a Plugability mechanism to allow a compliant SAX or DOM parser
    to be used indipendently by an application.
  
    <dl>
     <dt><b>Version: </b><dd>1.0 CVS $Revision: 1.1 $ $Date: 2000/02/26 05:56:30 $</dd>
     <dt><b>Author: </b>
       <dd><a href="pier@betaversion.org">Pierpaolo Fumagalli</a></dd>
     <dt><b>Copyright:</b>
       <dd>Copyright &copy; 1999-2000, Pierpaolo Fumagalli
         <a href="mailto:pier@betaversion.org">pier@betaversion.org</a></dd>
    </dl>
  
    <b>ATTENTION:</b> THIS IMPLEMENTATION OF THE "JAVAX.XML.PARSER" CLASSES
    IS PROVIDED FOR EXPERIMENTAL PURPOSES ONLY AND IS NOT THE OFFICIAL
    REFERENCE IMPLEMENTATION OF THE JAVA SPECIFICATION REQUEST 5 FOUND AT
    <a href="http://java.sun.com/aboutJava/communityprocess/jsr/jsr_005_xml.html">
    http://java.sun.com/aboutJava/communityprocess/jsr/jsr_005_xml.html
    </a>
    <br>
    THIS IMPLEMENTATION IS CONFORMANT TO THE "JAVA API FOR XML PARSING"
    SPECIFICATION VERSION 1.0 PUBLIC RELEASE 1 BY JAMES DUNCAN DAVIDSON
    PUBLISHED BY SUN MICROSYSTEMS ON FEB. 18, 2000 AND FOUND AT
    <a href="http://java.sun.com/xml">http://java.sun.com/xml</a>
    <br>
    <br>
    <b>THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
    WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
    MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
    EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
    PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
    OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
    WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
    OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
    ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   </body>
  </html>
  
  
  1.1                  xml-xerces/java/src/javax/xml/parsers/ParserConfigurationException.java
  
  Index: ParserConfigurationException.java
  ===================================================================
  /******************************************************************************
   * Copyright (C) 1999-2000, Pierpaolo Fumagalli <ma...@betaversion.org> *
   *                                                                            *
   * Redistribution and use in source  and/or in binary forms,  with or without *
   * modification are hereby permitted provided that the above copyright notice *
   * the following disclaimers, and this paragraph are not altered.             *
   *                                                                            *
   * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, *
   * INCLUDING,  BUT NOT LIMITED TO,  THE IMPLIED WARRANTIES OF MERCHANTABILITY *
   * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE *
   * AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, *
   * OR CONSEQUENTIAL DAMAGES  (INCLUDING,  BUT NOT LIMITED TO,  PROCUREMENT OF *
   * SUBSTITUTE GOODS OR SERVICES;  LOSS OF USE, DATA, OR PROFITS;  OR BUSINESS *
   * INTERRUPTION)  HOWEVER CAUSED AND ON  ANY THEORY OF LIABILITY,  WHETHER IN *
   * CONTRACT,  STRICT LIABILITY,  OR TORT  (INCLUDING NEGLIGENCE OR OTHERWISE) *
   * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE *
   * POSSIBILITY OF SUCH DAMAGE.                                                *
   *                                                                            *
   * ATTENTION:                                                                 *
   *     THIS  IMPLEMENTATION  OF THE  "JAVAX.XML.PARSER"  CLASSES IS  PROVIDED *
   *     FOR  EXPERIMENTAL PURPOSES  ONLY  AND IS  NOT THE  OFFICIAL  REFERENCE *
   *     IMPLEMENTATION OF THE JAVA SPECIFICATION REQUEST 5 FOUND AT:           *
   *     <http://java.sun.com/aboutJava/communityprocess/jsr/jsr_005_xml.html>  *
   *                                                                            *
   *     THIS IMPLEMENTATION  IS CONFORMANT  TO THE  "JAVA API FOR XML PARSING" *
   *     SPECIFICATION  VERSION 1.0  PUBLIC RELEASE 1  BY JAMES DUNCAN DAVIDSON *
   *     ET AL. PUBLISHED BY SUN MICROSYSTEMS ON FEB. 18, 2000 AND FOUND AT:    *
   *     <http://java.sun.com/xml>                                              *
   ******************************************************************************/
  package javax.xml.parsers;
  
  /**
   * This exception is thrown if a factory cannot configure a parser given its
   * current configuration parameters.
   * <br>
   * For example, if a parser factory cannot create parsers that validate,
   * but have been configured to do so, it will throw this exception when a
   * parser is requested to via the parser creation methods.
   * <br>
   * Application developers are not expected to construct instances of this
   * exception type, but must catch them in code that obtains parser instances
   * from a factory.
   * <br>
   * <br>
   * <b>ATTENTION:</b> THIS IMPLEMENTATION OF THE "JAVAX.XML.PARSER" CLASSES
   *   IS PROVIDED FOR EXPERIMENTAL PURPOSES ONLY AND IS NOT THE OFFICIAL
   *   REFERENCE IMPLEMENTATION OF THE JAVA SPECIFICATION REQUEST 5 FOUND AT
   *   <a href="http://java.sun.com/aboutJava/communityprocess/jsr/jsr_005_xml.html">
   *   http://java.sun.com/aboutJava/communityprocess/jsr/jsr_005_xml.html
   *   </a><br>
   *   THIS IMPLEMENTATION IS CONFORMANT TO THE "JAVA API FOR XML PARSING"
   *   SPECIFICATION VERSION 1.0 PUBLIC RELEASE 1 BY JAMES DUNCAN DAVIDSON
   *   PUBLISHED BY SUN MICROSYSTEMS ON FEB. 18, 2000 AND FOUND AT
   *   <a href="http://java.sun.com/xml">http://java.sun.com/xml</a>
   * <br>
   * <br>
   * <b>THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
   * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
   * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
   * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
   * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
   * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
   * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
   * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   *
   * @author <a href="pier@betaversion.org">Pierpaolo Fumagalli</a>
   * @author Copyright &copy; 1999-2000, Pierpaolo Fumagalli
   *         <a href="mailto:pier@betaversion.org">pier@betaversion.org</a>
   * @version 1.0 CVS $Revision: 1.1 $ $Date: 2000/02/26 05:56:30 $
   */
  public class ParserConfigurationException extends Exception {
  
      /**
       * Constructs a new <code>ParserConfigurationException</code> with no
       * detail message.
       */
      public ParserConfigurationException() {
          super();
      }
  
      /**
       * Constructs a new <code>ParserConfigurationException</code> with the
       * given detail message.
       */
      public ParserConfigurationException(String msg) {
          super(msg);
      }
  }
  
  
  
  1.1                  xml-xerces/java/src/javax/xml/parsers/SAXParser.java
  
  Index: SAXParser.java
  ===================================================================
  /******************************************************************************
   * Copyright (C) 1999-2000, Pierpaolo Fumagalli <ma...@betaversion.org> *
   *                                                                            *
   * Redistribution and use in source  and/or in binary forms,  with or without *
   * modification are hereby permitted provided that the above copyright notice *
   * the following disclaimers, and this paragraph are not altered.             *
   *                                                                            *
   * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, *
   * INCLUDING,  BUT NOT LIMITED TO,  THE IMPLIED WARRANTIES OF MERCHANTABILITY *
   * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE *
   * AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, *
   * OR CONSEQUENTIAL DAMAGES  (INCLUDING,  BUT NOT LIMITED TO,  PROCUREMENT OF *
   * SUBSTITUTE GOODS OR SERVICES;  LOSS OF USE, DATA, OR PROFITS;  OR BUSINESS *
   * INTERRUPTION)  HOWEVER CAUSED AND ON  ANY THEORY OF LIABILITY,  WHETHER IN *
   * CONTRACT,  STRICT LIABILITY,  OR TORT  (INCLUDING NEGLIGENCE OR OTHERWISE) *
   * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE *
   * POSSIBILITY OF SUCH DAMAGE.                                                *
   *                                                                            *
   * ATTENTION:                                                                 *
   *     THIS  IMPLEMENTATION  OF THE  "JAVAX.XML.PARSER"  CLASSES IS  PROVIDED *
   *     FOR  EXPERIMENTAL PURPOSES  ONLY  AND IS  NOT THE  OFFICIAL  REFERENCE *
   *     IMPLEMENTATION OF THE JAVA SPECIFICATION REQUEST 5 FOUND AT:           *
   *     <http://java.sun.com/aboutJava/communityprocess/jsr/jsr_005_xml.html>  *
   *                                                                            *
   *     THIS IMPLEMENTATION  IS CONFORMANT  TO THE  "JAVA API FOR XML PARSING" *
   *     SPECIFICATION  VERSION 1.0  PUBLIC RELEASE 1  BY JAMES DUNCAN DAVIDSON *
   *     ET AL. PUBLISHED BY SUN MICROSYSTEMS ON FEB. 18, 2000 AND FOUND AT:    *
   *     <http://java.sun.com/xml>                                              *
   ******************************************************************************/
  package javax.xml.parsers;
  
  import java.io.File;
  import java.io.InputStream;
  import java.io.IOException;
  import org.xml.sax.HandlerBase;
  import org.xml.sax.InputSource;
  import org.xml.sax.Parser;
  import org.xml.sax.SAXException;
  
  /**
   * Implementation instances of the <code>SAXParser</code> abstract class
   * contain an implementation of the <code>org.xml.sax.Parser</code> interface
   * and enables content from a variety of sources to be parsed using the
   * contained parser.
   * <br>
   * Instances of <code>SAXParser</code> are obtained from a
   * <code>SAXParserFactory</code> by invoking its <code>newSAXParser()</code>
   * method.
   * <br>
   * <br>
   * <b>ATTENTION:</b> THIS IMPLEMENTATION OF THE "JAVAX.XML.PARSER" CLASSES
   *   IS PROVIDED FOR EXPERIMENTAL PURPOSES ONLY AND IS NOT THE OFFICIAL
   *   REFERENCE IMPLEMENTATION OF THE JAVA SPECIFICATION REQUEST 5 FOUND AT
   *   <a href="http://java.sun.com/aboutJava/communityprocess/jsr/jsr_005_xml.html">
   *   http://java.sun.com/aboutJava/communityprocess/jsr/jsr_005_xml.html
   *   </a><br>
   *   THIS IMPLEMENTATION IS CONFORMANT TO THE "JAVA API FOR XML PARSING"
   *   SPECIFICATION VERSION 1.0 PUBLIC RELEASE 1 BY JAMES DUNCAN DAVIDSON
   *   PUBLISHED BY SUN MICROSYSTEMS ON FEB. 18, 2000 AND FOUND AT
   *   <a href="http://java.sun.com/xml">http://java.sun.com/xml</a>
   * <br>
   * <br>
   * <b>THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
   * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
   * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
   * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
   * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
   * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
   * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
   * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   *
   * @author <a href="pier@betaversion.org">Pierpaolo Fumagalli</a>
   * @author Copyright &copy; 1999-2000, Pierpaolo Fumagalli
   *         <a href="mailto:pier@betaversion.org">pier@betaversion.org</a>
   * @version 1.0 CVS $Revision: 1.1 $ $Date: 2000/02/26 05:56:30 $
   */
  public abstract class SAXParser {
  
      /**
       * Implementations should provide a protected constructor so that 
       * their factory implementation can instantiate instances of the 
       * implementation class.
       * <br>
       * Application programmers should not be able to directly construct 
       * implementation subclasses of this abstract subclass. The only way a 
       * application should be able to obtain a reference to a SAXParser 
       * implementation instance is by using the appropriate methods of the 
       * <code>SAXParserFactory</code>.
       */
      protected SAXParser() {
          super();
      }
  
      /**
       * Parses the contents of the given <code>InputStream</code> as an XML
       * document using the specified <code>HandlerBase</code> object.
       *
       * @exception SAXException If there is a problem parsing the given XML
       *                content.
       * @exception IOException If any IO errors occur reading the given
       *                <code>InputStream</code>.
       * @exception  IllegalArgumentException If the given
       *                <code>InputStream</code> is <b>null</b>.
       */
      public void parse(InputStream stream, HandlerBase base)
      throws SAXException, IOException, IllegalArgumentException {
          if (stream==null) throw new IllegalArgumentException();
          this.parse(new InputSource(stream),base);
      }
  
      /**
       * Parses the content of the given URI as an XML document using the
       * specified <code>HandlerBase</code> object.
       *
       * @exception SAXException If there is a problem parsing the given XML
       *                content.
       * @exception IOException If any IO errors occur while reading content
       *                located by the given URI.
       * @exception IllegalArgumentException If the given URI is <b>null</b>.
       */
      public void parse(String uri, HandlerBase base)
      throws SAXException, IOException, IllegalArgumentException {
          if (uri==null) throw new IllegalArgumentException();
          this.parse(new InputSource(uri),base);
      }
  
      /**
       * Parses the content of the given <code>File</code> as an XML document
       * using the specified <code>HandlerBase</code> object.
       *
       * @exception SAXException If there is a problem parsing the given XML
       *                content.
       * @exception IOException if any IO errors occur while reading content
       *                from the given <code>File</code>.
       * @exception IllegalArgumentException if the given <code>File</code> is
       *                <b>null</b>.
       */
      public void parse(File file, HandlerBase base)
      throws SAXException, IOException, IllegalArgumentException {
          if (file==null) throw new IllegalArgumentException();
          this.parse(new InputSource(file.getName()),base);
      }
  
      /**
       * Parses the content of the given <code>InputSource</code> as an XML
       * document using the specified <code>HandlerBase</code> object.
       *
       * @exception SAXException If there is a problem parsing the given XML
       *                content.
       * @exception IOException if any IO Errors occur while reading content
       *                from the given <code>InputSource</code>.
       * @exception IllegalArgumentException if the given
       *                <code>InputSource</code> is <b>null</b>.
       */
      public void parse(InputSource source, HandlerBase base)
      throws SAXException, IOException, IllegalArgumentException {
          if (source==null) throw new IllegalArgumentException();
  
          // Get the SAX parser instance
          Parser p=this.getParser();
  
          // Set the various handler instances
          if (base!=null) {
              p.setDocumentHandler(base);
              p.setDTDHandler(base);
              p.setEntityResolver(base);
              p.setErrorHandler(base);
          }
  
          // Parse the specified source
          p.parse(source);
      }
  
      /**
       * Returns the underlying <code>Parser</code> object which is wrapped by
       * this <code>SAXParser</code> implementation.
       *
       * @exception SAXException If the initialization of the underlying parser
       *                fails. <b>NOTE:</b> This Exception is specified on page
       *                21 of the specification, but later on omissed in this
       *                method documentation on page 23. Wich one is correct?
       */
      public abstract Parser getParser()
      throws SAXException;
  
      /**
       * Returns whether or not this parser supports XML namespaces.
       */
      public abstract boolean isNamespaceAware();
  
      /**
       * Returns whether or not this parser supports validating XML content.
       */
      public abstract boolean isValidating();
  }
  
  
  1.1                  xml-xerces/java/src/javax/xml/parsers/SAXParserFactory.java
  
  Index: SAXParserFactory.java
  ===================================================================
  /******************************************************************************
   * Copyright (C) 1999-2000, Pierpaolo Fumagalli <ma...@betaversion.org> *
   *                                                                            *
   * Redistribution and use in source  and/or in binary forms,  with or without *
   * modification are hereby permitted provided that the above copyright notice *
   * the following disclaimers, and this paragraph are not altered.             *
   *                                                                            *
   * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, *
   * INCLUDING,  BUT NOT LIMITED TO,  THE IMPLIED WARRANTIES OF MERCHANTABILITY *
   * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE *
   * AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, *
   * OR CONSEQUENTIAL DAMAGES  (INCLUDING,  BUT NOT LIMITED TO,  PROCUREMENT OF *
   * SUBSTITUTE GOODS OR SERVICES;  LOSS OF USE, DATA, OR PROFITS;  OR BUSINESS *
   * INTERRUPTION)  HOWEVER CAUSED AND ON  ANY THEORY OF LIABILITY,  WHETHER IN *
   * CONTRACT,  STRICT LIABILITY,  OR TORT  (INCLUDING NEGLIGENCE OR OTHERWISE) *
   * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE *
   * POSSIBILITY OF SUCH DAMAGE.                                                *
   *                                                                            *
   * ATTENTION:                                                                 *
   *     THIS  IMPLEMENTATION  OF THE  "JAVAX.XML.PARSER"  CLASSES IS  PROVIDED *
   *     FOR  EXPERIMENTAL PURPOSES  ONLY  AND IS  NOT THE  OFFICIAL  REFERENCE *
   *     IMPLEMENTATION OF THE JAVA SPECIFICATION REQUEST 5 FOUND AT:           *
   *     <http://java.sun.com/aboutJava/communityprocess/jsr/jsr_005_xml.html>  *
   *                                                                            *
   *     THIS IMPLEMENTATION  IS CONFORMANT  TO THE  "JAVA API FOR XML PARSING" *
   *     SPECIFICATION  VERSION 1.0  PUBLIC RELEASE 1  BY JAMES DUNCAN DAVIDSON *
   *     ET AL. PUBLISHED BY SUN MICROSYSTEMS ON FEB. 18, 2000 AND FOUND AT:    *
   *     <http://java.sun.com/xml>                                              *
   ******************************************************************************/
  package javax.xml.parsers;
  
  import org.xml.sax.SAXException;
  
  /**
   * The <code>SAXParserFactory</code> defines a factory API that enables
   * applications to configure and obtain a SAX based parser to parse XML
   * documents.
   * <br>
   * <br>
   * <b>ATTENTION:</b> THIS IMPLEMENTATION OF THE "JAVAX.XML.PARSER" CLASSES
   *   IS PROVIDED FOR EXPERIMENTAL PURPOSES ONLY AND IS NOT THE OFFICIAL
   *   REFERENCE IMPLEMENTATION OF THE JAVA SPECIFICATION REQUEST 5 FOUND AT
   *   <a href="http://java.sun.com/aboutJava/communityprocess/jsr/jsr_005_xml.html">
   *   http://java.sun.com/aboutJava/communityprocess/jsr/jsr_005_xml.html
   *   </a><br>
   *   THIS IMPLEMENTATION IS CONFORMANT TO THE "JAVA API FOR XML PARSING"
   *   SPECIFICATION VERSION 1.0 PUBLIC RELEASE 1 BY JAMES DUNCAN DAVIDSON
   *   PUBLISHED BY SUN MICROSYSTEMS ON FEB. 18, 2000 AND FOUND AT
   *   <a href="http://java.sun.com/xml">http://java.sun.com/xml</a>
   * <br>
   * <br>
   * <b>THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
   * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
   * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
   * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
   * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
   * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
   * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
   * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   *
   * @author <a href="pier@betaversion.org">Pierpaolo Fumagalli</a>
   * @author Copyright &copy; 1999-2000, Pierpaolo Fumagalli
   *         <a href="mailto:pier@betaversion.org">pier@betaversion.org</a>
   * @version 1.0 CVS $Revision: 1.1 $ $Date: 2000/02/26 05:56:31 $
   */
  public abstract class SAXParserFactory {
  
      /** Wether the SAXParser to be generated must support namespaces. */
      private boolean namespaces=false;
      /** Wether the SAXParser to be generated must support validataion. */
      private boolean validation=false;
      /** The system property to check for the SAXParserFactory class name. */
      private static String property="javax.xml.parsers.SAXParserFactory";
      /** The default SAXParserFactory implementation class name. */
      private static String factory="org.apache.xerces.jaxp.SAXParserFactoryImpl";
  
      /**
       * Implementors of this abstract class <b>must</b> provide their own
       * public no-argument constructor in order for the static
       * <code>newInstance()</code> method to work correctly.
       * <br>
       * Application programmers should be able to instantiate an implementation
       * of this abstract class directly if they want to use a specfic
       * implementation of this API without using the static newInstance method
       * to obtain the configured or platform default implementation.
       */
      protected SAXParserFactory() {
          super();
      }
  
      /**
       * Returns a new instance of a <code>SAXParserFactory</code>.
       * <br>
       * The implementation of the SAX-ParserFactory returned depends on the
       * setting of the <code>javax.xml.parsers.SAXParserFactory</code>
       * system property or, if the property is not set, a platform specific
       * default.
       *
       * @exception FactoryConfigurationError If the class implementing the
       *                factory cannot be found or instantiated.
       *                An <code>Error</code> is thrown instead of an exception
       *                because the application is not expected to handle or
       *                recover from such events.
       */
      public static SAXParserFactory newInstance() {
  
          // Evaluate wether we have to use or Class.forName() for JDK 1.1 or
          // Thread.currentThread().getContextClassLoader().loadClass() for
          // the new JDK 1.2
          boolean newPlatform=true;
          try {
              new ThreadLocal();
          } catch (NoClassDefFoundError t) {
              newPlatform=false;
          }
  
          // Retrieve the javax.xml.parsers.SAXParserFactory system property
          String n=System.getProperty(property, factory);
  
          try {
              // Attempt to load the factory class.
              Class c=null;
              if (!newPlatform) c=Class.forName(n);
              else c=Thread.currentThread().getContextClassLoader().loadClass(n);
  
              // Attempt to instantiate and return the factory class
              return (SAXParserFactory)c.newInstance();
  
          } catch (ClassNotFoundException e) {
              // The factory class was not found
              throw new FactoryConfigurationError("Cannot load class "+
                  "SAXParserFactory class \""+n+"\"");
  
          } catch (InstantiationException e) {
              // The factory class wasn't instantiated
              throw new FactoryConfigurationError("Cannot instantiate the "+
                  "specified SAXParserFactory class \""+n+"\"");
  
          } catch (IllegalAccessException e) {
              // The factory class couldn't have been accessed
              throw new FactoryConfigurationError("Cannot access the specified "+
                  "SAXParserFactory class \""+n+"\"");
  
          } catch (ClassCastException e) {
              // The factory class was not a SAXParserFactory
              throw new FactoryConfigurationError("The specified class \""+n+
                  "\" is not instance of \"javax.xml.parsers.SAXParserFactory\"");
          }
      }
  
      /**
       * Returns a new configured instance of type <code>SAXParser</code>.
       *
       * @exception ParserConfigurationException If the <code>SAXParser</code>
       *                instance cannot be created with the requested
       *                configuration.
       * @exception SAXException If the initialization of the underlying parser
       *                fails.
       */
      public abstract SAXParser newSAXParser()
      throws ParserConfigurationException, SAXException;
  
      /**
       * Configuration method that specifies whether the parsers created by this
       * factory are required to provide XML namespace support or not.
       * <br>
       * <b>NOTE:</b> if a parser cannot be created by this factory that
       *     satisfies the requested namespace awareness value, a
       *     <code>ParserConfigurationException</code> will be thrown when the
       *     program attempts to aquire the parser calling the
       *     <code>newSaxParser()</code> method.
       */
      public void setNamespaceAware(boolean aware) {
          this.namespaces=aware;
      }
  
      /**
       * Configuration method whether specifies if the parsers created by this
       * factory are required to validate the XML documents that they parse.
       * <br>
       * <b>NOTE:</b> if a parser cannot be created by this factory that
       *     satisfies the requested validation capacity, a
       *     <code>ParserConfigurationException</code> will be thrown when
       *     the application attempts to aquire the parser via the
       *     <code>newSaxParser()</code> method.
       */
      public void setValidating(boolean validating) {
          this.validation=validating;
      }
  
      /**
       * Indicates if this <code>SAXParserFactory</code> is configured to
       * produce parsers that are namespace aware or not.
       */
      public boolean isNamespaceAware() {
          return(this.namespaces);
      }
  
      /**
       * Indicates if this <code>SAXParserFactory</code> is configured to
       * produce parsers that validate XML documents as they are parsed.
       */
      public boolean isValidating() {
          return(this.validation);
      }
  }