You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commons-cvs@xml.apache.org by mr...@apache.org on 2005/06/03 20:28:57 UTC

cvs commit: xml-commons/java/external/src/javax/xml/parsers DocumentBuilder.java SAXParser.java

mrglavas    2005/06/03 11:28:57

  Modified:    java/external/src/javax/xml/transform/stream
                        StreamSource.java
               java/external/src/javax/xml/parsers DocumentBuilder.java
                        SAXParser.java
  Log:
  Fixing Bugzilla #34913:
  http://issues.apache.org/bugzilla/show_bug.cgi?id=34913
  
  Usage of the File to URI conversion code only existed on the tck-jaxp-1_2_0 branch.
  Merging these fixes into the main branch. For some reason the diffs are showing
  the entire file changed however the changes are local to the methods which convert
  File objects into URIs.
  
  Revision  Changes    Path
  1.5       +280 -279  xml-commons/java/external/src/javax/xml/transform/stream/StreamSource.java
  
  Index: StreamSource.java
  ===================================================================
  RCS file: /home/cvs/xml-commons/java/external/src/javax/xml/transform/stream/StreamSource.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- StreamSource.java	8 Apr 2005 10:39:14 -0000	1.4
  +++ StreamSource.java	3 Jun 2005 18:28:57 -0000	1.5
  @@ -1,279 +1,280 @@
  -/*
  - * Copyright 2003-2004 The Apache Software Foundation.
  - *
  - * Licensed under the Apache License, Version 2.0 (the "License");
  - * you may not use this file except in compliance with the License.
  - * You may obtain a copy of the License at
  - *
  - *     http://www.apache.org/licenses/LICENSE-2.0
  - *
  - * Unless required by applicable law or agreed to in writing, software
  - * distributed under the License is distributed on an "AS IS" BASIS,
  - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  - * See the License for the specific language governing permissions and
  - * limitations under the License.
  - */
  -
  -// $Id$
  -
  -package javax.xml.transform.stream;
  -
  -import java.io.File;
  -import java.io.InputStream;
  -import java.io.Reader;
  -
  -import javax.xml.transform.Source;
  -
  -/**
  - * <p>Acts as an holder for a transformation Source in the form
  - * of a stream of XML markup.</p>
  - *
  - * <p><em>Note:</em> Due to their internal use of either a {@link Reader} or {@link InputStream} instance,
  - * <code>StreamSource</code> instances may only be used once.</p>
  - *
  - * @author <a href="Jeff.Suttor@Sun.com">Jeff Suttor</a>
  - * @version $Revision$, $Date$
  - */
  -public class StreamSource implements Source {
  -
  -    /** If {@link javax.xml.transform.TransformerFactory#getFeature}
  -     * returns true when passed this value as an argument,
  -     * the Transformer supports Source input of this type.
  -     */
  -    public static final String FEATURE =
  -        "http://javax.xml.transform.stream.StreamSource/feature";
  -    
  -    /**
  -     * <p>Zero-argument default constructor.  If this constructor is used, and
  -     * no Stream source is set using
  -     * {@link #setInputStream(java.io.InputStream inputStream)} or
  -     * {@link #setReader(java.io.Reader reader)}, then the
  -     * <code>Transformer</code> will
  -     * create an empty source {@link java.io.InputStream} using
  -     * {@link java.io.InputStream#InputStream() new InputStream()}.</p>
  -     * 
  -     * @see javax.xml.transform.Transformer#transform(Source xmlSource, Result outputTarget)
  -     */    
  -    public StreamSource() { }
  -
  -    /**
  -     * Construct a StreamSource from a byte stream.  Normally,
  -     * a stream should be used rather than a reader, so
  -     * the XML parser can resolve character encoding specified
  -     * by the XML declaration.
  -     *
  -     * <p>If this constructor is used to process a stylesheet, normally
  -     * setSystemId should also be called, so that relative URI references
  -     * can be resolved.</p>
  -     *
  -     * @param inputStream A valid InputStream reference to an XML stream.
  -     */
  -    public StreamSource(InputStream inputStream) {
  -        setInputStream(inputStream);
  -    }
  -
  -    /**
  -     * Construct a StreamSource from a byte stream.  Normally,
  -     * a stream should be used rather than a reader, so that
  -     * the XML parser can resolve character encoding specified
  -     * by the XML declaration.
  -     *
  -     * <p>This constructor allows the systemID to be set in addition
  -     * to the input stream, which allows relative URIs
  -     * to be processed.</p>
  -     *
  -     * @param inputStream A valid InputStream reference to an XML stream.
  -     * @param systemId Must be a String that conforms to the URI syntax.
  -     */
  -    public StreamSource(InputStream inputStream, String systemId) {
  -        setInputStream(inputStream);
  -        setSystemId(systemId);
  -    }
  -
  -    /**
  -     * Construct a StreamSource from a character reader.  Normally,
  -     * a stream should be used rather than a reader, so that
  -     * the XML parser can resolve character encoding specified
  -     * by the XML declaration.  However, in many cases the encoding
  -     * of the input stream is already resolved, as in the case of
  -     * reading XML from a StringReader.
  -     *
  -     * @param reader A valid Reader reference to an XML character stream.
  -     */
  -    public StreamSource(Reader reader) {
  -        setReader(reader);
  -    }
  -
  -    /**
  -     * Construct a StreamSource from a character reader.  Normally,
  -     * a stream should be used rather than a reader, so that
  -     * the XML parser may resolve character encoding specified
  -     * by the XML declaration.  However, in many cases the encoding
  -     * of the input stream is already resolved, as in the case of
  -     * reading XML from a StringReader.
  -     *
  -     * @param reader A valid Reader reference to an XML character stream.
  -     * @param systemId Must be a String that conforms to the URI syntax.
  -     */
  -    public StreamSource(Reader reader, String systemId) {
  -        setReader(reader);
  -        setSystemId(systemId);
  -    }
  -
  -    /**
  -     * Construct a StreamSource from a URL.
  -     *
  -     * @param systemId Must be a String that conforms to the URI syntax.
  -     */
  -    public StreamSource(String systemId) {
  -        this.systemId = systemId;
  -    }
  -
  -    /**
  -     * Construct a StreamSource from a File.
  -     *
  -     * @param f Must a non-null File reference.
  -     */
  -    public StreamSource(File f) {
  -        setSystemId(f);
  -    }
  -
  -    /**
  -     * Set the byte stream to be used as input.  Normally,
  -     * a stream should be used rather than a reader, so that
  -     * the XML parser can resolve character encoding specified
  -     * by the XML declaration.
  -     *
  -     * <p>If this Source object is used to process a stylesheet, normally
  -     * setSystemId should also be called, so that relative URL references
  -     * can be resolved.</p>
  -     *
  -     * @param inputStream A valid InputStream reference to an XML stream.
  -     */
  -    public void setInputStream(InputStream inputStream) {
  -        this.inputStream = inputStream;
  -    }
  -
  -    /**
  -     * Get the byte stream that was set with setByteStream.
  -     *
  -     * @return The byte stream that was set with setByteStream, or null
  -     * if setByteStream or the ByteStream constructor was not called.
  -     */
  -    public InputStream getInputStream() {
  -        return inputStream;
  -    }
  -
  -    /**
  -     * Set the input to be a character reader.  Normally,
  -     * a stream should be used rather than a reader, so that
  -     * the XML parser can resolve character encoding specified
  -     * by the XML declaration.  However, in many cases the encoding
  -     * of the input stream is already resolved, as in the case of
  -     * reading XML from a StringReader.
  -     *
  -     * @param reader A valid Reader reference to an XML CharacterStream.
  -     */
  -    public void setReader(Reader reader) {
  -        this.reader = reader;
  -    }
  -
  -    /**
  -     * Get the character stream that was set with setReader.
  -     *
  -     * @return The character stream that was set with setReader, or null
  -     * if setReader or the Reader constructor was not called.
  -     */
  -    public Reader getReader() {
  -        return reader;
  -    }
  -
  -    /**
  -     * Set the public identifier for this Source.
  -     *
  -     * <p>The public identifier is always optional: if the application
  -     * writer includes one, it will be provided as part of the
  -     * location information.</p>
  -     *
  -     * @param publicId The public identifier as a string.
  -     */
  -    public void setPublicId(String publicId) {
  -        this.publicId = publicId;
  -    }
  -
  -    /**
  -     * Get the public identifier that was set with setPublicId.
  -     *
  -     * @return The public identifier that was set with setPublicId, or null
  -     * if setPublicId was not called.
  -     */
  -    public String getPublicId() {
  -        return publicId;
  -    }
  -
  -    /**
  -     * Set the system identifier for this Source.
  -     *
  -     * <p>The system identifier is optional if there is a byte stream
  -     * or a character stream, but it is still useful to provide one,
  -     * since the application can use it to resolve relative URIs
  -     * and can include it in error messages and warnings (the parser
  -     * will attempt to open a connection to the URI only if
  -     * there is no byte stream or character stream specified).</p>
  -     *
  -     * @param systemId The system identifier as a URL string.
  -     */
  -    public void setSystemId(String systemId) {
  -        this.systemId = systemId;
  -    }
  -
  -    /**
  -     * Get the system identifier that was set with setSystemId.
  -     *
  -     * @return The system identifier that was set with setSystemId, or null
  -     * if setSystemId was not called.
  -     */
  -    public String getSystemId() {
  -        return systemId;
  -    }
  -
  -    /**
  -     * Set the system ID from a File reference.
  -     *
  -     * @param f Must a non-null File reference.
  -     */
  -    public void setSystemId(File f) {
  -        String fpath=f.getAbsolutePath();
  -        if (File.separatorChar != '/') {
  -            fpath = fpath.replace(File.separatorChar, '/');
  -        }
  -        if( fpath.startsWith("/"))
  -          this.systemId= "file://" + fpath;
  -        else
  -          this.systemId = "file:///" + fpath;
  -    }
  -
  -    //////////////////////////////////////////////////////////////////////
  -    // Internal state.
  -    //////////////////////////////////////////////////////////////////////
  -
  -    /**
  -     * The public identifier for this input source, or null.
  -     */
  -    private String publicId;
  -
  -    /**
  -     * The system identifier as a URL string, or null.
  -     */
  -    private String systemId;
  -
  -    /**
  -     * The byte stream for this Source, or null.
  -     */
  -    private InputStream inputStream;
  -
  -    /**
  -     * The character stream for this Source, or null.
  -     */
  -    private Reader reader;
  -}
  +/*
  + * Copyright 2003-2005 The Apache Software Foundation.
  + *
  + * Licensed under the Apache License, Version 2.0 (the "License");
  + * you may not use this file except in compliance with the License.
  + * You may obtain a copy of the License at
  + *
  + *     http://www.apache.org/licenses/LICENSE-2.0
  + *
  + * Unless required by applicable law or agreed to in writing, software
  + * distributed under the License is distributed on an "AS IS" BASIS,
  + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  + * See the License for the specific language governing permissions and
  + * limitations under the License.
  + */
  +
  +// $Id$
  +
  +package javax.xml.transform.stream;
  +
  +import java.io.File;
  +import java.io.InputStream;
  +import java.io.Reader;
  +
  +import javax.xml.transform.Source;
  +
  +/**
  + * <p>Acts as an holder for a transformation Source in the form
  + * of a stream of XML markup.</p>
  + *
  + * <p><em>Note:</em> Due to their internal use of either a {@link Reader} or {@link InputStream} instance,
  + * <code>StreamSource</code> instances may only be used once.</p>
  + *
  + * @author <a href="Jeff.Suttor@Sun.com">Jeff Suttor</a>
  + * @version $Revision$, $Date$
  + */
  +public class StreamSource implements Source {
  +
  +    /** If {@link javax.xml.transform.TransformerFactory#getFeature}
  +     * returns true when passed this value as an argument,
  +     * the Transformer supports Source input of this type.
  +     */
  +    public static final String FEATURE =
  +        "http://javax.xml.transform.stream.StreamSource/feature";
  +    
  +    /**
  +     * <p>Zero-argument default constructor.  If this constructor is used, and
  +     * no Stream source is set using
  +     * {@link #setInputStream(java.io.InputStream inputStream)} or
  +     * {@link #setReader(java.io.Reader reader)}, then the
  +     * <code>Transformer</code> will
  +     * create an empty source {@link java.io.InputStream} using
  +     * {@link java.io.InputStream#InputStream() new InputStream()}.</p>
  +     * 
  +     * @see javax.xml.transform.Transformer#transform(Source xmlSource, Result outputTarget)
  +     */    
  +    public StreamSource() { }
  +
  +    /**
  +     * Construct a StreamSource from a byte stream.  Normally,
  +     * a stream should be used rather than a reader, so
  +     * the XML parser can resolve character encoding specified
  +     * by the XML declaration.
  +     *
  +     * <p>If this constructor is used to process a stylesheet, normally
  +     * setSystemId should also be called, so that relative URI references
  +     * can be resolved.</p>
  +     *
  +     * @param inputStream A valid InputStream reference to an XML stream.
  +     */
  +    public StreamSource(InputStream inputStream) {
  +        setInputStream(inputStream);
  +    }
  +
  +    /**
  +     * Construct a StreamSource from a byte stream.  Normally,
  +     * a stream should be used rather than a reader, so that
  +     * the XML parser can resolve character encoding specified
  +     * by the XML declaration.
  +     *
  +     * <p>This constructor allows the systemID to be set in addition
  +     * to the input stream, which allows relative URIs
  +     * to be processed.</p>
  +     *
  +     * @param inputStream A valid InputStream reference to an XML stream.
  +     * @param systemId Must be a String that conforms to the URI syntax.
  +     */
  +    public StreamSource(InputStream inputStream, String systemId) {
  +        setInputStream(inputStream);
  +        setSystemId(systemId);
  +    }
  +
  +    /**
  +     * Construct a StreamSource from a character reader.  Normally,
  +     * a stream should be used rather than a reader, so that
  +     * the XML parser can resolve character encoding specified
  +     * by the XML declaration.  However, in many cases the encoding
  +     * of the input stream is already resolved, as in the case of
  +     * reading XML from a StringReader.
  +     *
  +     * @param reader A valid Reader reference to an XML character stream.
  +     */
  +    public StreamSource(Reader reader) {
  +        setReader(reader);
  +    }
  +
  +    /**
  +     * Construct a StreamSource from a character reader.  Normally,
  +     * a stream should be used rather than a reader, so that
  +     * the XML parser may resolve character encoding specified
  +     * by the XML declaration.  However, in many cases the encoding
  +     * of the input stream is already resolved, as in the case of
  +     * reading XML from a StringReader.
  +     *
  +     * @param reader A valid Reader reference to an XML character stream.
  +     * @param systemId Must be a String that conforms to the URI syntax.
  +     */
  +    public StreamSource(Reader reader, String systemId) {
  +        setReader(reader);
  +        setSystemId(systemId);
  +    }
  +
  +    /**
  +     * Construct a StreamSource from a URL.
  +     *
  +     * @param systemId Must be a String that conforms to the URI syntax.
  +     */
  +    public StreamSource(String systemId) {
  +        this.systemId = systemId;
  +    }
  +
  +    /**
  +     * Construct a StreamSource from a File.
  +     *
  +     * @param f Must a non-null File reference.
  +     */
  +    public StreamSource(File f) {
  +        setSystemId(f);
  +    }
  +
  +    /**
  +     * Set the byte stream to be used as input.  Normally,
  +     * a stream should be used rather than a reader, so that
  +     * the XML parser can resolve character encoding specified
  +     * by the XML declaration.
  +     *
  +     * <p>If this Source object is used to process a stylesheet, normally
  +     * setSystemId should also be called, so that relative URL references
  +     * can be resolved.</p>
  +     *
  +     * @param inputStream A valid InputStream reference to an XML stream.
  +     */
  +    public void setInputStream(InputStream inputStream) {
  +        this.inputStream = inputStream;
  +    }
  +
  +    /**
  +     * Get the byte stream that was set with setByteStream.
  +     *
  +     * @return The byte stream that was set with setByteStream, or null
  +     * if setByteStream or the ByteStream constructor was not called.
  +     */
  +    public InputStream getInputStream() {
  +        return inputStream;
  +    }
  +
  +    /**
  +     * Set the input to be a character reader.  Normally,
  +     * a stream should be used rather than a reader, so that
  +     * the XML parser can resolve character encoding specified
  +     * by the XML declaration.  However, in many cases the encoding
  +     * of the input stream is already resolved, as in the case of
  +     * reading XML from a StringReader.
  +     *
  +     * @param reader A valid Reader reference to an XML CharacterStream.
  +     */
  +    public void setReader(Reader reader) {
  +        this.reader = reader;
  +    }
  +
  +    /**
  +     * Get the character stream that was set with setReader.
  +     *
  +     * @return The character stream that was set with setReader, or null
  +     * if setReader or the Reader constructor was not called.
  +     */
  +    public Reader getReader() {
  +        return reader;
  +    }
  +
  +    /**
  +     * Set the public identifier for this Source.
  +     *
  +     * <p>The public identifier is always optional: if the application
  +     * writer includes one, it will be provided as part of the
  +     * location information.</p>
  +     *
  +     * @param publicId The public identifier as a string.
  +     */
  +    public void setPublicId(String publicId) {
  +        this.publicId = publicId;
  +    }
  +
  +    /**
  +     * Get the public identifier that was set with setPublicId.
  +     *
  +     * @return The public identifier that was set with setPublicId, or null
  +     * if setPublicId was not called.
  +     */
  +    public String getPublicId() {
  +        return publicId;
  +    }
  +
  +    /**
  +     * Set the system identifier for this Source.
  +     *
  +     * <p>The system identifier is optional if there is a byte stream
  +     * or a character stream, but it is still useful to provide one,
  +     * since the application can use it to resolve relative URIs
  +     * and can include it in error messages and warnings (the parser
  +     * will attempt to open a connection to the URI only if
  +     * there is no byte stream or character stream specified).</p>
  +     *
  +     * @param systemId The system identifier as a URL string.
  +     */
  +    public void setSystemId(String systemId) {
  +        this.systemId = systemId;
  +    }
  +
  +    /**
  +     * Get the system identifier that was set with setSystemId.
  +     *
  +     * @return The system identifier that was set with setSystemId, or null
  +     * if setSystemId was not called.
  +     */
  +    public String getSystemId() {
  +        return systemId;
  +    }
  +
  +    /**
  +     * Set the system ID from a File reference.
  +     *
  +     * @param f Must a non-null File reference.
  +     */
  +    public void setSystemId(File f) {
  +        this.systemId = FilePathToURI.filepath2URI(f.getAbsolutePath());
  +//      String fpath=f.getAbsolutePath();
  +//      if (File.separatorChar != '/') {
  +//          fpath = fpath.replace(File.separatorChar, '/');
  +//      }
  +//            if( fpath.startsWith("/"))
  +//        this.systemId= "file://" + fpath;
  +//      else
  +//        this.systemId = "file:///" + fpath;
  +    }
  +
  +    //////////////////////////////////////////////////////////////////////
  +    // Internal state.
  +    //////////////////////////////////////////////////////////////////////
  +
  +    /**
  +     * The public identifier for this input source, or null.
  +     */
  +    private String publicId;
  +
  +    /**
  +     * The system identifier as a URL string, or null.
  +     */
  +    private String systemId;
  +
  +    /**
  +     * The byte stream for this Source, or null.
  +     */
  +    private InputStream inputStream;
  +
  +    /**
  +     * The character stream for this Source, or null.
  +     */
  +    private Reader reader;
  +}
  
  
  
  1.7       +328 -325  xml-commons/java/external/src/javax/xml/parsers/DocumentBuilder.java
  
  Index: DocumentBuilder.java
  ===================================================================
  RCS file: /home/cvs/xml-commons/java/external/src/javax/xml/parsers/DocumentBuilder.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- DocumentBuilder.java	8 Apr 2005 10:39:13 -0000	1.6
  +++ DocumentBuilder.java	3 Jun 2005 18:28:57 -0000	1.7
  @@ -1,325 +1,328 @@
  -/*
  - * Copyright 2003-2004 The Apache Software Foundation.
  - *
  - * Licensed under the Apache License, Version 2.0 (the "License");
  - * you may not use this file except in compliance with the License.
  - * You may obtain a copy of the License at
  - *
  - *     http://www.apache.org/licenses/LICENSE-2.0
  - *
  - * Unless required by applicable law or agreed to in writing, software
  - * distributed under the License is distributed on an "AS IS" BASIS,
  - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  - * See the License for the specific language governing permissions and
  - * limitations under the License.
  - */
  -
  -// $Id$
  -
  -package javax.xml.parsers;
  -
  -import java.io.File;
  -import java.io.IOException;
  -import java.io.InputStream;
  -
  -import javax.xml.validation.Schema;
  -
  -import org.w3c.dom.Document;
  -import org.w3c.dom.DOMImplementation;
  -
  -import org.xml.sax.EntityResolver;
  -import org.xml.sax.ErrorHandler;
  -import org.xml.sax.InputSource;
  -import org.xml.sax.SAXException;
  -
  -/**
  - * Defines the API to obtain DOM Document instances from an XML
  - * document. Using this class, an application programmer can obtain a
  - * {@link Document} from XML.<p>
  - *
  - * An instance of this class can be obtained from the
  - * {@link DocumentBuilderFactory#newDocumentBuilder()} method. Once
  - * an instance of this class is obtained, XML can be parsed from a
  - * variety of input sources. These input sources are InputStreams,
  - * Files, URLs, and SAX InputSources.<p>
  - *
  - * Note that this class reuses 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 document into a
  - * <code>Document</code>. It merely requires that the implementation
  - * communicate with the application using these existing APIs.
  - *
  - * @author <a href="mailto:Jeff.Suttor@Sun.com">Jeff Suttor</a>
  - * @version $Revision$, $Date$
  - */
  -
  -public abstract class DocumentBuilder {
  -    
  -    
  -    /** Protected constructor */
  -    protected DocumentBuilder () {
  -    }
  -
  -	/**
  -	  * <p>Reset this <code>DocumentBuilder</code> to its original configuration.</p>
  -	  * 
  -	  * <p><code>DocumentBuilder</code> is reset to the same state as when it was created with
  -	  * {@link DocumentBuilderFactory#newDocumentBuilder()}.
  -	  * <code>reset()</code> is designed to allow the reuse of existing <code>DocumentBuilder</code>s
  -	  * thus saving resources associated with the creation of new <code>DocumentBuilder</code>s.</p>
  -	  * 
  -	  * <p>The reset <code>DocumentBuilder</code> is not guaranteed to have the same {@link EntityResolver} or {@link ErrorHandler}
  -	  * <code>Object</code>s, e.g. {@link Object#equals(Object obj)}.  It is guaranteed to have a functionally equal
  -	  * <code>EntityResolver</code> and <code>ErrorHandler</code>.</p>
  -	  * 
  -	  * @since 1.5
  -	  */
  -	public void reset() {
  -	
  -		// implementors should override this method
  -		throw new UnsupportedOperationException(
  -			"This DocumentBuilder, \"" + this.getClass().getName() + "\", does not support the reset functionality."
  -			+ "  Specification \"" + this.getClass().getPackage().getSpecificationTitle() + "\""
  -			+ " version \"" + this.getClass().getPackage().getSpecificationVersion() + "\""
  -			);
  -	}
  -
  -    /**
  -     * Parse the content of the given <code>InputStream</code> as an XML
  -     * document and return a new DOM {@link Document} object.
  -     * An <code>IllegalArgumentException</code> is thrown if the
  -     * <code>InputStream</code> is null.
  -     *
  -     * @param is InputStream containing the content to be parsed.
  -     * @return <code>Document</code> result of parsing the
  -     *  <code>InputStream</code>
  -     * @exception IOException If any IO errors occur.
  -     * @exception SAXException If any parse errors occur.
  -     * @see org.xml.sax.DocumentHandler
  -     */
  -    
  -    public Document parse(InputStream is)
  -        throws SAXException, IOException {
  -        if (is == null) {
  -            throw new IllegalArgumentException("InputStream cannot be null");
  -        }
  -        
  -        InputSource in = new InputSource(is);
  -        return parse(in);
  -    }
  -
  -    /**
  -     * Parse the content of the given <code>InputStream</code> as an
  -     * XML document and return a new DOM {@link Document} object.
  -     * An <code>IllegalArgumentException</code> is thrown if the
  -     * <code>InputStream</code> is null.
  -     *
  -     * @param is InputStream containing the content to be parsed.
  -     * @param systemId Provide a base for resolving relative URIs.
  -     * @return A new DOM Document object.
  -     * @exception IOException If any IO errors occur.
  -     * @exception SAXException If any parse errors occur.
  -     * @see org.xml.sax.DocumentHandler
  -     */
  -    
  -    public Document parse(InputStream is, String systemId)
  -        throws SAXException, IOException {
  -        if (is == null) {
  -            throw new IllegalArgumentException("InputStream cannot be null");
  -        }
  -        
  -        InputSource in = new InputSource(is);
  -        in.setSystemId(systemId);
  -        return parse(in);
  -    }
  -
  -    /**
  -     * Parse the content of the given URI as an XML document
  -     * and return a new DOM {@link Document} object.
  -     * An <code>IllegalArgumentException</code> is thrown if the
  -     * URI is <code>null</code> null.
  -     *
  -     * @param uri The location of the content to be parsed.
  -     * @return A new DOM Document object.
  -     * @exception IOException If any IO errors occur.
  -     * @exception SAXException If any parse errors occur.
  -     * @see org.xml.sax.DocumentHandler
  -     */
  -    
  -    public Document parse(String uri)
  -        throws SAXException, IOException {
  -        if (uri == null) {
  -            throw new IllegalArgumentException("URI cannot be null");
  -        }
  -        
  -        InputSource in = new InputSource(uri);
  -        return parse(in);
  -    }
  -
  -    /**
  -     * Parse the content of the given file as an XML document
  -     * and return a new DOM {@link Document} object.
  -     * An <code>IllegalArgumentException</code> is thrown if the
  -     * <code>File</code> is <code>null</code> null.
  -     *
  -     * @param f The file containing the XML to parse.
  -     * @exception IOException If any IO errors occur.
  -     * @exception SAXException If any parse errors occur.
  -     * @see org.xml.sax.DocumentHandler
  -     * @return A new DOM Document object.
  -     */
  -    
  -    public Document parse(File f) throws SAXException, IOException {
  -        if (f == null) {
  -            throw new IllegalArgumentException("File cannot be null");
  -        }
  -
  -        String uri = "file:" + f.getAbsolutePath();
  -        if (File.separatorChar == '\\') {
  -            uri = uri.replace('\\', '/');
  -        }
  -        InputSource in = new InputSource(uri);
  -        return parse(in);
  -    }
  -
  -    /**
  -     * Parse the content of the given input source as an XML document
  -     * and return a new DOM {@link Document} object.
  -     * An <code>IllegalArgumentException</code> is thrown if the
  -     * <code>InputSource</code> is <code>null</code> null.
  -     *
  -     * @param is InputSource containing the content to be parsed.
  -     * @exception IOException If any IO errors occur.
  -     * @exception SAXException If any parse errors occur.
  -     * @see org.xml.sax.DocumentHandler
  -     * @return A new DOM Document object.
  -     */
  -    
  -    public abstract Document parse(InputSource is)
  -        throws  SAXException, IOException;
  -
  -    
  -    /**
  -     * Indicates whether or not this parser is configured to
  -     * understand namespaces.
  -     *
  -     * @return true if this parser is configured to understand
  -     *         namespaces; false otherwise.
  -     */
  -
  -    public abstract boolean isNamespaceAware();
  -
  -    /**
  -     * Indicates whether or not this parser is configured to
  -     * validate XML documents.
  -     *
  -     * @return true if this parser is configured to validate
  -     *         XML documents; false otherwise.
  -     */
  -    
  -    public abstract boolean isValidating();
  -
  -    /**
  -     * Specify the {@link EntityResolver} to be used to resolve
  -     * entities present in the XML document to be parsed. Setting
  -     * this to <code>null</code> will result in the underlying
  -     * implementation using it's own default implementation and
  -     * behavior.
  -     *
  -     * @param er The <code>EntityResolver</code> to be used to resolve entities
  -     *           present in the XML document to be parsed.
  -     */
  -
  -    public abstract void setEntityResolver(EntityResolver er);
  -
  -    /**
  -     * Specify the {@link ErrorHandler} to be used by the parser.
  -     * Setting this to <code>null</code> will result in the underlying
  -     * implementation using it's own default implementation and
  -     * behavior.
  -     *
  -     * @param eh The <code>ErrorHandler</code> to be used by the parser.
  -     */
  -
  -    public abstract void setErrorHandler(ErrorHandler eh);
  -
  -    /**
  -     * Obtain a new instance of a DOM {@link Document} object
  -     * to build a DOM tree with.
  -     *
  -     * @return A new instance of a DOM Document object.
  -     */
  -    
  -    public abstract Document newDocument();
  -
  -    /**
  -     * Obtain an instance of a {@link DOMImplementation} object.
  -     *
  -     * @return A new instance of a <code>DOMImplementation</code>.
  -     */
  -
  -    public abstract DOMImplementation getDOMImplementation();
  -    
  -    /** <p>Get current state of canonicalization.</p>
  -     *
  -     * @return current state canonicalization control
  -     */
  -    /*
  -    public boolean getCanonicalization() {
  -        return canonicalState;
  -    }
  -    */
  -    
  -    /** <p>Get a reference to the the {@link Schema} being used by
  -     * the XML processor.</p>
  -     *
  -     * <p>If no schema is being used, <code>null</code> is returned.</p>
  -     *
  -     * @return {@link Schema} being used or <code>null</code>
  -     *  if none in use
  -     * 
  -     * @throws UnsupportedOperationException
  -     *      For backward compatibility, when implementations for
  -     *      earlier versions of JAXP is used, this exception will be
  -     *      thrown.
  -     * 
  -     * @since 1.5
  -     */
  -    public Schema getSchema() {
  -        throw new UnsupportedOperationException(
  -            "This parser does not support specification \""
  -            + this.getClass().getPackage().getSpecificationTitle()
  -            + "\" version \""
  -            + this.getClass().getPackage().getSpecificationVersion()
  -            + "\""
  -            );
  -    }
  -    
  -    
  -    /**
  -     * <p>Get the XInclude processing mode for this parser.</p>
  -     * 
  -     * @return
  -     *      the return value of
  -     *      the {@link DocumentBuilderFactory#isXIncludeAware()}
  -     *      when this parser was created from factory.
  -     * 
  -     * @throws UnsupportedOperationException
  -     *      For backward compatibility, when implementations for
  -     *      earlier versions of JAXP is used, this exception will be
  -     *      thrown.
  -     * 
  -     * @since 1.5
  -     * 
  -     * @see DocumentBuilderFactory#setXIncludeAware(boolean)
  -     */
  -    public boolean isXIncludeAware() {
  -        throw new UnsupportedOperationException(
  -            "This parser does not support specification \""
  -            + this.getClass().getPackage().getSpecificationTitle()
  -            + "\" version \""
  -            + this.getClass().getPackage().getSpecificationVersion()
  -            + "\""
  -            );
  -    }
  -}
  +/*
  + * Copyright 2003-2005 The Apache Software Foundation.
  + *
  + * Licensed under the Apache License, Version 2.0 (the "License");
  + * you may not use this file except in compliance with the License.
  + * You may obtain a copy of the License at
  + *
  + *     http://www.apache.org/licenses/LICENSE-2.0
  + *
  + * Unless required by applicable law or agreed to in writing, software
  + * distributed under the License is distributed on an "AS IS" BASIS,
  + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  + * See the License for the specific language governing permissions and
  + * limitations under the License.
  + */
  +
  +// $Id$
  +
  +package javax.xml.parsers;
  +
  +import java.io.File;
  +import java.io.IOException;
  +import java.io.InputStream;
  +
  +import javax.xml.validation.Schema;
  +
  +import org.w3c.dom.Document;
  +import org.w3c.dom.DOMImplementation;
  +
  +import org.xml.sax.EntityResolver;
  +import org.xml.sax.ErrorHandler;
  +import org.xml.sax.InputSource;
  +import org.xml.sax.SAXException;
  +
  +/**
  + * Defines the API to obtain DOM Document instances from an XML
  + * document. Using this class, an application programmer can obtain a
  + * {@link Document} from XML.<p>
  + *
  + * An instance of this class can be obtained from the
  + * {@link DocumentBuilderFactory#newDocumentBuilder()} method. Once
  + * an instance of this class is obtained, XML can be parsed from a
  + * variety of input sources. These input sources are InputStreams,
  + * Files, URLs, and SAX InputSources.<p>
  + *
  + * Note that this class reuses 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 document into a
  + * <code>Document</code>. It merely requires that the implementation
  + * communicate with the application using these existing APIs.
  + *
  + * @author <a href="mailto:Jeff.Suttor@Sun.com">Jeff Suttor</a>
  + * @version $Revision$, $Date$
  + */
  +
  +public abstract class DocumentBuilder {
  +    
  +    private static final boolean DEBUG = false;
  +    
  +    /** Protected constructor */
  +    protected DocumentBuilder () {
  +    }
  +
  +	/**
  +	  * <p>Reset this <code>DocumentBuilder</code> to its original configuration.</p>
  +	  * 
  +	  * <p><code>DocumentBuilder</code> is reset to the same state as when it was created with
  +	  * {@link DocumentBuilderFactory#newDocumentBuilder()}.
  +	  * <code>reset()</code> is designed to allow the reuse of existing <code>DocumentBuilder</code>s
  +	  * thus saving resources associated with the creation of new <code>DocumentBuilder</code>s.</p>
  +	  * 
  +	  * <p>The reset <code>DocumentBuilder</code> is not guaranteed to have the same {@link EntityResolver} or {@link ErrorHandler}
  +	  * <code>Object</code>s, e.g. {@link Object#equals(Object obj)}.  It is guaranteed to have a functionally equal
  +	  * <code>EntityResolver</code> and <code>ErrorHandler</code>.</p>
  +	  * 
  +	  * @since 1.5
  +	  */
  +	public void reset() {
  +	
  +		// implementors should override this method
  +		throw new UnsupportedOperationException(
  +			"This DocumentBuilder, \"" + this.getClass().getName() + "\", does not support the reset functionality."
  +			+ "  Specification \"" + this.getClass().getPackage().getSpecificationTitle() + "\""
  +			+ " version \"" + this.getClass().getPackage().getSpecificationVersion() + "\""
  +			);
  +	}
  +
  +    /**
  +     * Parse the content of the given <code>InputStream</code> as an XML
  +     * document and return a new DOM {@link Document} object.
  +     * An <code>IllegalArgumentException</code> is thrown if the
  +     * <code>InputStream</code> is null.
  +     *
  +     * @param is InputStream containing the content to be parsed.
  +     * @return <code>Document</code> result of parsing the
  +     *  <code>InputStream</code>
  +     * @exception IOException If any IO errors occur.
  +     * @exception SAXException If any parse errors occur.
  +     * @see org.xml.sax.DocumentHandler
  +     */
  +    
  +    public Document parse(InputStream is)
  +        throws SAXException, IOException {
  +        if (is == null) {
  +            throw new IllegalArgumentException("InputStream cannot be null");
  +        }
  +        
  +        InputSource in = new InputSource(is);
  +        return parse(in);
  +    }
  +
  +    /**
  +     * Parse the content of the given <code>InputStream</code> as an
  +     * XML document and return a new DOM {@link Document} object.
  +     * An <code>IllegalArgumentException</code> is thrown if the
  +     * <code>InputStream</code> is null.
  +     *
  +     * @param is InputStream containing the content to be parsed.
  +     * @param systemId Provide a base for resolving relative URIs.
  +     * @return A new DOM Document object.
  +     * @exception IOException If any IO errors occur.
  +     * @exception SAXException If any parse errors occur.
  +     * @see org.xml.sax.DocumentHandler
  +     */
  +    
  +    public Document parse(InputStream is, String systemId)
  +        throws SAXException, IOException {
  +        if (is == null) {
  +            throw new IllegalArgumentException("InputStream cannot be null");
  +        }
  +        
  +        InputSource in = new InputSource(is);
  +        in.setSystemId(systemId);
  +        return parse(in);
  +    }
  +
  +    /**
  +     * Parse the content of the given URI as an XML document
  +     * and return a new DOM {@link Document} object.
  +     * An <code>IllegalArgumentException</code> is thrown if the
  +     * URI is <code>null</code> null.
  +     *
  +     * @param uri The location of the content to be parsed.
  +     * @return A new DOM Document object.
  +     * @exception IOException If any IO errors occur.
  +     * @exception SAXException If any parse errors occur.
  +     * @see org.xml.sax.DocumentHandler
  +     */
  +    
  +    public Document parse(String uri)
  +        throws SAXException, IOException {
  +        if (uri == null) {
  +            throw new IllegalArgumentException("URI cannot be null");
  +        }
  +        
  +        InputSource in = new InputSource(uri);
  +        return parse(in);
  +    }
  +
  +    /**
  +     * Parse the content of the given file as an XML document
  +     * and return a new DOM {@link Document} object.
  +     * An <code>IllegalArgumentException</code> is thrown if the
  +     * <code>File</code> is <code>null</code> null.
  +     *
  +     * @param f The file containing the XML to parse.
  +     * @exception IOException If any IO errors occur.
  +     * @exception SAXException If any parse errors occur.
  +     * @see org.xml.sax.DocumentHandler
  +     * @return A new DOM Document object.
  +     */
  +    
  +    public Document parse(File f) throws SAXException, IOException {
  +        if (f == null) {
  +            throw new IllegalArgumentException("File cannot be null");
  +        }
  +        
  +        String escapedURI = FilePathToURI.filepath2URI(f.getAbsolutePath());
  +        
  +        if (DEBUG) {
  +            System.out.println("Escaped URI = " + escapedURI);
  +        }
  +
  +        InputSource in = new InputSource(escapedURI);
  +        return parse(in);
  +    }
  +
  +    /**
  +     * Parse the content of the given input source as an XML document
  +     * and return a new DOM {@link Document} object.
  +     * An <code>IllegalArgumentException</code> is thrown if the
  +     * <code>InputSource</code> is <code>null</code> null.
  +     *
  +     * @param is InputSource containing the content to be parsed.
  +     * @exception IOException If any IO errors occur.
  +     * @exception SAXException If any parse errors occur.
  +     * @see org.xml.sax.DocumentHandler
  +     * @return A new DOM Document object.
  +     */
  +    
  +    public abstract Document parse(InputSource is)
  +        throws  SAXException, IOException;
  +
  +    
  +    /**
  +     * Indicates whether or not this parser is configured to
  +     * understand namespaces.
  +     *
  +     * @return true if this parser is configured to understand
  +     *         namespaces; false otherwise.
  +     */
  +
  +    public abstract boolean isNamespaceAware();
  +
  +    /**
  +     * Indicates whether or not this parser is configured to
  +     * validate XML documents.
  +     *
  +     * @return true if this parser is configured to validate
  +     *         XML documents; false otherwise.
  +     */
  +    
  +    public abstract boolean isValidating();
  +
  +    /**
  +     * Specify the {@link EntityResolver} to be used to resolve
  +     * entities present in the XML document to be parsed. Setting
  +     * this to <code>null</code> will result in the underlying
  +     * implementation using it's own default implementation and
  +     * behavior.
  +     *
  +     * @param er The <code>EntityResolver</code> to be used to resolve entities
  +     *           present in the XML document to be parsed.
  +     */
  +
  +    public abstract void setEntityResolver(EntityResolver er);
  +
  +    /**
  +     * Specify the {@link ErrorHandler} to be used by the parser.
  +     * Setting this to <code>null</code> will result in the underlying
  +     * implementation using it's own default implementation and
  +     * behavior.
  +     *
  +     * @param eh The <code>ErrorHandler</code> to be used by the parser.
  +     */
  +
  +    public abstract void setErrorHandler(ErrorHandler eh);
  +
  +    /**
  +     * Obtain a new instance of a DOM {@link Document} object
  +     * to build a DOM tree with.
  +     *
  +     * @return A new instance of a DOM Document object.
  +     */
  +    
  +    public abstract Document newDocument();
  +
  +    /**
  +     * Obtain an instance of a {@link DOMImplementation} object.
  +     *
  +     * @return A new instance of a <code>DOMImplementation</code>.
  +     */
  +
  +    public abstract DOMImplementation getDOMImplementation();
  +    
  +    /** <p>Get current state of canonicalization.</p>
  +     *
  +     * @return current state canonicalization control
  +     */
  +    /*
  +    public boolean getCanonicalization() {
  +        return canonicalState;
  +    }
  +    */
  +    
  +    /** <p>Get a reference to the the {@link Schema} being used by
  +     * the XML processor.</p>
  +     *
  +     * <p>If no schema is being used, <code>null</code> is returned.</p>
  +     *
  +     * @return {@link Schema} being used or <code>null</code>
  +     *  if none in use
  +     * 
  +     * @throws UnsupportedOperationException
  +     *      For backward compatibility, when implementations for
  +     *      earlier versions of JAXP is used, this exception will be
  +     *      thrown.
  +     * 
  +     * @since 1.5
  +     */
  +    public Schema getSchema() {
  +        throw new UnsupportedOperationException(
  +            "This parser does not support specification \""
  +            + this.getClass().getPackage().getSpecificationTitle()
  +            + "\" version \""
  +            + this.getClass().getPackage().getSpecificationVersion()
  +            + "\""
  +            );
  +    }
  +    
  +    
  +    /**
  +     * <p>Get the XInclude processing mode for this parser.</p>
  +     * 
  +     * @return
  +     *      the return value of
  +     *      the {@link DocumentBuilderFactory#isXIncludeAware()}
  +     *      when this parser was created from factory.
  +     * 
  +     * @throws UnsupportedOperationException
  +     *      For backward compatibility, when implementations for
  +     *      earlier versions of JAXP is used, this exception will be
  +     *      thrown.
  +     * 
  +     * @since 1.5
  +     * 
  +     * @see DocumentBuilderFactory#setXIncludeAware(boolean)
  +     */
  +    public boolean isXIncludeAware() {
  +        throw new UnsupportedOperationException(
  +            "This parser does not support specification \""
  +            + this.getClass().getPackage().getSpecificationTitle()
  +            + "\" version \""
  +            + this.getClass().getPackage().getSpecificationVersion()
  +            + "\""
  +            );
  +    }
  +}
  
  
  
  1.7       +535 -529  xml-commons/java/external/src/javax/xml/parsers/SAXParser.java
  
  Index: SAXParser.java
  ===================================================================
  RCS file: /home/cvs/xml-commons/java/external/src/javax/xml/parsers/SAXParser.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- SAXParser.java	8 Apr 2005 10:39:13 -0000	1.6
  +++ SAXParser.java	3 Jun 2005 18:28:57 -0000	1.7
  @@ -1,529 +1,535 @@
  -/*
  - * Copyright 2003-2004 The Apache Software Foundation.
  - *
  - * Licensed under the Apache License, Version 2.0 (the "License");
  - * you may not use this file except in compliance with the License.
  - * You may obtain a copy of the License at
  - *
  - *     http://www.apache.org/licenses/LICENSE-2.0
  - *
  - * Unless required by applicable law or agreed to in writing, software
  - * distributed under the License is distributed on an "AS IS" BASIS,
  - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  - * See the License for the specific language governing permissions and
  - * limitations under the License.
  - */
  -
  -// $Id$
  -
  -package javax.xml.parsers;
  -
  -import java.io.File;
  -import java.io.IOException;
  -import java.io.InputStream;
  -
  -import javax.xml.validation.Schema;
  -
  -import org.xml.sax.HandlerBase;
  -import org.xml.sax.InputSource;
  -import org.xml.sax.Parser;
  -import org.xml.sax.SAXException;
  -import org.xml.sax.SAXNotRecognizedException;
  -import org.xml.sax.SAXNotSupportedException;
  -import org.xml.sax.XMLReader;
  -import org.xml.sax.helpers.DefaultHandler;
  -
  -
  -/**
  - * Defines the API that wraps an {@link org.xml.sax.XMLReader}
  - * implementation class. In JAXP 1.0, this class wrapped the
  - * {@link org.xml.sax.Parser} interface, however this interface was
  - * replaced by the {@link org.xml.sax.XMLReader}. For ease
  - * of transition, this class continues to support the same name
  - * and interface as well as supporting new methods.
  - *
  - * An instance of this class can be obtained from the
  - * {@link javax.xml.parsers.SAXParserFactory#newSAXParser()} method.
  - * Once an instance of this class is obtained, XML can be parsed from
  - * a variety of input sources. These input sources are InputStreams,
  - * Files, URLs, and SAX InputSources.<p>
  - *
  - * This static method creates a new factory instance based
  - * on a system property setting or uses the platform default
  - * if no property has been defined.<p>
  - *
  - * The system property that controls which Factory implementation
  - * to create is named <code>&quot;javax.xml.parsers.SAXParserFactory&quot;</code>.
  - * This property names a class that is a concrete subclass of this
  - * abstract class. If no property is defined, a platform default
  - * will be used.</p>
  - *
  - * As the content is parsed by the underlying parser, methods of the
  - * given {@link org.xml.sax.HandlerBase} or the
  - * {@link org.xml.sax.helpers.DefaultHandler} are called.<p>
  - *
  - * Implementors of this class which wrap an underlaying implementation
  - * can consider using the {@link org.xml.sax.helpers.ParserAdapter}
  - * class to initially adapt their SAX1 impelemntation to work under
  - * this revised class.
  - *
  - * @author <a href="mailto:Jeff.Suttor@Sun.com">Jeff Suttor</a>
  - * @version $Revision$, $Date$
  - */
  -public abstract class SAXParser {
  -        
  -    /**
  -     * <p>Protected constructor to prevent instaniation.
  -     * Use {@link javax.xml.parsers.SAXParserFactory#newSAXParser()}.</p>
  -     */
  -    protected SAXParser () {
  -    
  -    }
  -
  -	/**
  -	 * <p>Reset this <code>SAXParser</code> to its original configuration.</p>
  -	 * 
  -	 * <p><code>SAXParser</code> is reset to the same state as when it was created with
  -	 * {@link SAXParserFactory#newSAXParser()}.
  -	 * <code>reset()</code> is designed to allow the reuse of existing <code>SAXParser</code>s
  -	 * thus saving resources associated with the creation of new <code>SAXParser</code>s.</p>
  -	 * 
  -	 * <p>The reset <code>SAXParser</code> is not guaranteed to have the same {@link Schema}
  -	 * <code>Object</code>, e.g. {@link Object#equals(Object obj)}.  It is guaranteed to have a functionally equal
  -	 * <code>Schema</code>.</p>
  -	 * 
  -	 * @since 1.5
  -	 */
  -	public void reset() {
  -
  -		// implementors should override this method
  -		throw new UnsupportedOperationException(
  -			"This SAXParser, \"" + this.getClass().getName() + "\", does not support the reset functionality."
  -			+ "  Specification \"" + this.getClass().getPackage().getSpecificationTitle() + "\""
  -			+ " version \"" + this.getClass().getPackage().getSpecificationVersion() + "\""
  -			);
  -	}
  -
  -    /**
  -     * <p>Parse the content of the given {@link java.io.InputStream}
  -     * instance as XML using the specified {@link org.xml.sax.HandlerBase}.
  -     * <i> Use of the DefaultHandler version of this method is recommended as
  -     * the HandlerBase class has been deprecated in SAX 2.0</i>.</p>
  -     *
  -     * @param is InputStream containing the content to be parsed.
  -     * @param hb The SAX HandlerBase to use.
  -     * 
  -     * @throws IllegalArgumentException If the given InputStream is null.
  -     * @throws SAXException If parse produces a SAX error.
  -     * @throws IOException If an IO error occurs interacting with the
  -     *   <code>InputStream</code>.
  -     * 
  -     * @see org.xml.sax.DocumentHandler
  -     */    
  -    public void parse(InputStream is, HandlerBase hb)
  -        throws SAXException, IOException {
  -        if (is == null) {
  -            throw new IllegalArgumentException("InputStream cannot be null");
  -        }
  -
  -        InputSource input = new InputSource(is);
  -        this.parse(input, hb);
  -    }
  -
  -    /**
  -     * <p>Parse the content of the given {@link java.io.InputStream}
  -     * instance as XML using the specified {@link org.xml.sax.HandlerBase}.
  -     * <i> Use of the DefaultHandler version of this method is recommended as
  -     * the HandlerBase class has been deprecated in SAX 2.0</i>.</p>
  -     *
  -     * @param is InputStream containing the content to be parsed.
  -     * @param hb The SAX HandlerBase to use.
  -     * @param systemId The systemId which is needed for resolving relative URIs.
  -     * 
  -     * @throws IllegalArgumentException If the given <code>InputStream</code> is
  -     *   <code>null</code>.
  -     * @throws IOException If any IO error occurs interacting with the
  -     *   <code>InputStream</code>.
  -     * @throws SAXException If any SAX errors occur during processing.
  -     * 
  -     * @see org.xml.sax.DocumentHandler version of this method instead.
  -     */
  -    public void parse(
  -        InputStream is,
  -        HandlerBase hb,
  -        String systemId)
  -        throws SAXException, IOException {
  -        if (is == null) {
  -            throw new IllegalArgumentException("InputStream cannot be null");
  -        }
  -
  -        InputSource input = new InputSource(is);
  -        input.setSystemId(systemId);
  -        this.parse(input, hb);
  -    }
  -   
  -    /**
  -     * Parse the content of the given {@link java.io.InputStream}
  -     * instance as XML using the specified
  -     * {@link org.xml.sax.helpers.DefaultHandler}.
  -     *
  -     * @param is InputStream containing the content to be parsed.
  -     * @param dh The SAX DefaultHandler to use.
  -     * 
  -     * @throws IllegalArgumentException If the given InputStream is null.
  -     * @throws IOException If any IO errors occur.
  -     * @throws SAXException If any SAX errors occur during processing.
  -     * 
  -     * @see org.xml.sax.DocumentHandler
  -     */
  -    public void parse(InputStream is, DefaultHandler dh)
  -        throws SAXException, IOException {
  -        if (is == null) {
  -            throw new IllegalArgumentException("InputStream cannot be null");
  -        }
  -
  -        InputSource input = new InputSource(is);
  -        this.parse(input, dh);
  -    }
  -
  -    /**
  -     * Parse the content of the given {@link java.io.InputStream}
  -     * instance as XML using the specified
  -     * {@link org.xml.sax.helpers.DefaultHandler}.
  -     *
  -     * @param is InputStream containing the content to be parsed.
  -     * @param dh The SAX DefaultHandler to use.
  -     * @param systemId The systemId which is needed for resolving relative URIs.
  -     * 
  -     * @throws IllegalArgumentException If the given InputStream is null.
  -     * @throws IOException If any IO errors occur.
  -     * @throws SAXException If any SAX errors occur during processing.
  -     * 
  -     * @see org.xml.sax.DocumentHandler version of this method instead.
  -     */
  -    public void parse(
  -        InputStream is,
  -        DefaultHandler dh,
  -        String systemId)
  -        throws SAXException, IOException {
  -        if (is == null) {
  -            throw new IllegalArgumentException("InputStream cannot be null");
  -        }
  -
  -        InputSource input = new InputSource(is);
  -        input.setSystemId(systemId);
  -        this.parse(input, dh);
  -    }
  -
  -    /**
  -     * Parse the content described by the giving Uniform Resource
  -     * Identifier (URI) as XML using the specified
  -     * {@link org.xml.sax.HandlerBase}.
  -     * <i> Use of the DefaultHandler version of this method is recommended as
  -     * the <code>HandlerBase</code> class has been deprecated in SAX 2.0</i>
  -     *
  -     * @param uri The location of the content to be parsed.
  -     * @param hb The SAX HandlerBase to use.
  -     * 
  -     * @throws IllegalArgumentException If the uri is null.
  -     * @throws IOException If any IO errors occur.
  -     * @throws SAXException If any SAX errors occur during processing.
  -     * 
  -     * @see org.xml.sax.DocumentHandler
  -     */
  -    public void parse(String uri, HandlerBase hb)
  -        throws SAXException, IOException {
  -        if (uri == null) {
  -            throw new IllegalArgumentException("uri cannot be null");
  -        }
  -
  -        InputSource input = new InputSource(uri);
  -        this.parse(input, hb);
  -    }
  -  
  -    /**
  -     * Parse the content described by the giving Uniform Resource
  -     * Identifier (URI) as XML using the specified
  -     * {@link org.xml.sax.helpers.DefaultHandler}.
  -     *
  -     * @param uri The location of the content to be parsed.
  -     * @param dh The SAX DefaultHandler to use.
  -     * 
  -     * @throws IllegalArgumentException If the uri is null.
  -     * @throws IOException If any IO errors occur.
  -     * @throws SAXException If any SAX errors occur during processing.
  -     * 
  -     * @see org.xml.sax.DocumentHandler
  -     */   
  -    public void parse(String uri, DefaultHandler dh)
  -        throws SAXException, IOException {
  -        if (uri == null) {
  -            throw new IllegalArgumentException("uri cannot be null");
  -        }
  -
  -        InputSource input = new InputSource(uri);
  -        this.parse(input, dh);
  -    }
  -    
  -    /**
  -     * Parse the content of the file specified as XML using the
  -     * specified {@link org.xml.sax.HandlerBase}.
  -     * <i> Use of the DefaultHandler version of this method is recommended as
  -     * the HandlerBase class has been deprecated in SAX 2.0</i>
  -     *
  -     * @param f The file containing the XML to parse
  -     * @param hb The SAX HandlerBase to use.
  -     * 
  -     * @throws IllegalArgumentException If the File object is null.
  -     * @throws IOException If any IO errors occur.
  -     * @throws SAXException If any SAX errors occur during processing.
  -     * 
  -     * @see org.xml.sax.DocumentHandler
  -     */
  -    public void parse(File f, HandlerBase hb)
  -        throws SAXException, IOException {
  -        if (f == null) {
  -            throw new IllegalArgumentException("File cannot be null");
  -        }
  -
  -        String uri = "file:" + f.getAbsolutePath();
  -        if (File.separatorChar == '\\') {
  -            uri = uri.replace('\\', '/');
  -        }
  -        InputSource input = new InputSource(uri);
  -        this.parse(input, hb);
  -    }
  -    
  -    /**
  -     * Parse the content of the file specified as XML using the
  -     * specified {@link org.xml.sax.helpers.DefaultHandler}.
  -     *
  -     * @param f The file containing the XML to parse
  -     * @param dh The SAX DefaultHandler to use.
  -     * 
  -     * @throws IllegalArgumentException If the File object is null.
  -     * @throws IOException If any IO errors occur.
  -     * @throws SAXException If any SAX errors occur during processing.
  -     * 
  -     * @see org.xml.sax.DocumentHandler
  -     */
  -    public void parse(File f, DefaultHandler dh)
  -        throws SAXException, IOException {
  -        if (f == null) {
  -            throw new IllegalArgumentException("File cannot be null");
  -        }
  -
  -        String uri = "file:" + f.getAbsolutePath();
  -        if (File.separatorChar == '\\') {
  -            uri = uri.replace('\\', '/');
  -        }
  -        InputSource input = new InputSource(uri);
  -        this.parse(input, dh);
  -    }
  -    
  -    /**
  -     * Parse the content given {@link org.xml.sax.InputSource}
  -     * as XML using the specified
  -     * {@link org.xml.sax.HandlerBase}.
  -     * <i> Use of the DefaultHandler version of this method is recommended as
  -     * the HandlerBase class has been deprecated in SAX 2.0</i>
  -     *
  -     * @param is The InputSource containing the content to be parsed.
  -     * @param hb The SAX HandlerBase to use.
  -     * 
  -     * @throws IllegalArgumentException If the <code>InputSource</code> object
  -     *   is <code>null</code>.
  -     * @throws IOException If any IO errors occur.
  -     * @throws SAXException If any SAX errors occur during processing.
  -     * 
  -     * @see org.xml.sax.DocumentHandler
  -     */
  -    public void parse(InputSource is, HandlerBase hb)
  -        throws SAXException, IOException {
  -        if (is == null) {
  -            throw new IllegalArgumentException("InputSource cannot be null");
  -        }
  -
  -        Parser parser = this.getParser();
  -        if (hb != null) {
  -            parser.setDocumentHandler(hb);
  -            parser.setEntityResolver(hb);
  -            parser.setErrorHandler(hb);
  -            parser.setDTDHandler(hb);
  -        }
  -        parser.parse(is);
  -    }
  -    
  -    /**
  -     * Parse the content given {@link org.xml.sax.InputSource}
  -     * as XML using the specified
  -     * {@link org.xml.sax.helpers.DefaultHandler}.
  -     *
  -     * @param is The InputSource containing the content to be parsed.
  -     * @param dh The SAX DefaultHandler to use.
  -     * 
  -     * @throws IllegalArgumentException If the <code>InputSource</code> object
  -     *   is <code>null</code>.
  -     * @throws IOException If any IO errors occur.
  -     * @throws SAXException If any SAX errors occur during processing.
  -     * 
  -     * @see org.xml.sax.DocumentHandler
  -     */
  -    public void parse(InputSource is, DefaultHandler dh)
  -        throws SAXException, IOException {
  -        if (is == null) {
  -            throw new IllegalArgumentException("InputSource cannot be null");
  -        }
  -
  -        XMLReader reader = this.getXMLReader();
  -        if (dh != null) {
  -            reader.setContentHandler(dh);
  -            reader.setEntityResolver(dh);
  -            reader.setErrorHandler(dh);
  -            reader.setDTDHandler(dh);
  -        }
  -        reader.parse(is);
  -    }
  -    
  -    /**
  -     * Returns the SAX parser that is encapsultated by the
  -     * implementation of this class.
  -     *
  -     * @return The SAX parser that is encapsultated by the
  -     *         implementation of this class.
  -     * 
  -     * @throws SAXException If any SAX errors occur during processing.
  -     */
  -    public abstract org.xml.sax.Parser getParser() throws SAXException;
  -
  -    /**
  -     * Returns the {@link org.xml.sax.XMLReader} that is encapsulated by the
  -     * implementation of this class.
  -     *
  -     * @return The XMLReader that is encapsulated by the
  -     *         implementation of this class.
  -     * 
  -     * @throws SAXException If any SAX errors occur during processing.
  -     */
  -
  -    public abstract org.xml.sax.XMLReader getXMLReader() throws SAXException;
  -    
  -    /**
  -     * Indicates whether or not this parser is configured to
  -     * understand namespaces.
  -     *
  -     * @return true if this parser is configured to
  -     *         understand namespaces; false otherwise.
  -     */
  -    
  -    public abstract boolean isNamespaceAware();
  -
  -    /**
  -     * Indicates whether or not this parser is configured to
  -     * validate XML documents.
  -     *
  -     * @return true if this parser is configured to
  -     *         validate XML documents; false otherwise.
  -     */
  -    
  -    public abstract boolean isValidating();
  -
  -    /**
  -     * <p>Sets the particular property in the underlying implementation of
  -     * {@link org.xml.sax.XMLReader}.
  -     * A list of the core features and properties can be found at
  -     * <a href="http://sax.sourceforge.net/?selected=get-set">
  -     * http://sax.sourceforge.net/?selected=get-set</a>.</p>
  -     *
  -     * @param name The name of the property to be set.
  -     * @param value The value of the property to be set.
  -     * 
  -     * @throws SAXNotRecognizedException When the underlying XMLReader does
  -     *   not recognize the property name.
  -     * @throws SAXNotSupportedException When the underlying XMLReader
  -     *  recognizes the property name but doesn't support the property.
  -     *
  -     * @see org.xml.sax.XMLReader#setProperty
  -     */
  -    public abstract void setProperty(String name, Object value)
  -        throws SAXNotRecognizedException, SAXNotSupportedException;
  -
  -    /**
  -     * <p>Returns the particular property requested for in the underlying
  -     * implementation of {@link org.xml.sax.XMLReader}.</p>
  -     *
  -     * @param name The name of the property to be retrieved.
  -     * @return Value of the requested property.
  -     *
  -     * @throws SAXNotRecognizedException When the underlying XMLReader does
  -     *    not recognize the property name.
  -     * @throws SAXNotSupportedException When the underlying XMLReader
  -     *  recognizes the property name but doesn't support the property.
  -     *
  -     * @see org.xml.sax.XMLReader#getProperty
  -     */
  -    public abstract Object getProperty(String name)
  -        throws SAXNotRecognizedException, SAXNotSupportedException;
  -
  -    /** <p>Get current state of canonicalization.</p>
  -     *
  -     * @return current state canonicalization control
  -     */
  -    /*
  -    public boolean getCanonicalization() {
  -        return canonicalState;
  -    }    
  -    */
  -
  -    /** <p>Get a reference to the the {@link Schema} being used by
  -     * the XML processor.</p>
  -     *
  -     * <p>If no schema is being used, <code>null</code> is returned.</p>
  -     *
  -     * @return {@link Schema} being used or <code>null</code>
  -     *  if none in use
  -     * 
  -     * @throws UnsupportedOperationException
  -     *      For backward compatibility, when implementations for
  -     *      earlier versions of JAXP is used, this exception will be
  -     *      thrown.
  -     * 
  -     * @since 1.5
  -     */
  -    public Schema getSchema() {
  -        throw new UnsupportedOperationException(
  -            "This parser does not support specification \""
  -            + this.getClass().getPackage().getSpecificationTitle()
  -            + "\" version \""
  -            + this.getClass().getPackage().getSpecificationVersion()
  -            + "\""
  -            );
  -    }
  -    
  -    /**
  -     * <p>Get the XInclude processing mode for this parser.</p>
  -     * 
  -     * @return
  -     *      the return value of
  -     *      the {@link SAXParserFactory#isXIncludeAware()}
  -     *      when this parser was created from factory.
  -     * 
  -     * @throws UnsupportedOperationException
  -     *      For backward compatibility, when implementations for
  -     *      earlier versions of JAXP is used, this exception will be
  -     *      thrown.
  -     * 
  -     * @since 1.5
  -     * 
  -     * @see SAXParserFactory#setXIncludeAware(boolean)
  -     */
  -    public boolean isXIncludeAware() {
  -        throw new UnsupportedOperationException(
  -            "This parser does not support specification \""
  -            + this.getClass().getPackage().getSpecificationTitle()
  -            + "\" version \""
  -            + this.getClass().getPackage().getSpecificationVersion()
  -            + "\""
  -            );
  -    }
  -}
  +/*
  + * Copyright 2003-2005 The Apache Software Foundation.
  + *
  + * Licensed under the Apache License, Version 2.0 (the "License");
  + * you may not use this file except in compliance with the License.
  + * You may obtain a copy of the License at
  + *
  + *     http://www.apache.org/licenses/LICENSE-2.0
  + *
  + * Unless required by applicable law or agreed to in writing, software
  + * distributed under the License is distributed on an "AS IS" BASIS,
  + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  + * See the License for the specific language governing permissions and
  + * limitations under the License.
  + */
  +
  +// $Id$
  +
  +package javax.xml.parsers;
  +
  +import java.io.File;
  +import java.io.IOException;
  +import java.io.InputStream;
  +
  +import javax.xml.validation.Schema;
  +
  +import org.xml.sax.HandlerBase;
  +import org.xml.sax.InputSource;
  +import org.xml.sax.Parser;
  +import org.xml.sax.SAXException;
  +import org.xml.sax.SAXNotRecognizedException;
  +import org.xml.sax.SAXNotSupportedException;
  +import org.xml.sax.XMLReader;
  +import org.xml.sax.helpers.DefaultHandler;
  +
  +
  +/**
  + * Defines the API that wraps an {@link org.xml.sax.XMLReader}
  + * implementation class. In JAXP 1.0, this class wrapped the
  + * {@link org.xml.sax.Parser} interface, however this interface was
  + * replaced by the {@link org.xml.sax.XMLReader}. For ease
  + * of transition, this class continues to support the same name
  + * and interface as well as supporting new methods.
  + *
  + * An instance of this class can be obtained from the
  + * {@link javax.xml.parsers.SAXParserFactory#newSAXParser()} method.
  + * Once an instance of this class is obtained, XML can be parsed from
  + * a variety of input sources. These input sources are InputStreams,
  + * Files, URLs, and SAX InputSources.<p>
  + *
  + * This static method creates a new factory instance based
  + * on a system property setting or uses the platform default
  + * if no property has been defined.<p>
  + *
  + * The system property that controls which Factory implementation
  + * to create is named <code>&quot;javax.xml.parsers.SAXParserFactory&quot;</code>.
  + * This property names a class that is a concrete subclass of this
  + * abstract class. If no property is defined, a platform default
  + * will be used.</p>
  + *
  + * As the content is parsed by the underlying parser, methods of the
  + * given {@link org.xml.sax.HandlerBase} or the
  + * {@link org.xml.sax.helpers.DefaultHandler} are called.<p>
  + *
  + * Implementors of this class which wrap an underlaying implementation
  + * can consider using the {@link org.xml.sax.helpers.ParserAdapter}
  + * class to initially adapt their SAX1 impelemntation to work under
  + * this revised class.
  + *
  + * @author <a href="mailto:Jeff.Suttor@Sun.com">Jeff Suttor</a>
  + * @version $Revision$, $Date$
  + */
  +public abstract class SAXParser {
  +    
  +    private static final boolean DEBUG = false;
  +        
  +    /**
  +     * <p>Protected constructor to prevent instaniation.
  +     * Use {@link javax.xml.parsers.SAXParserFactory#newSAXParser()}.</p>
  +     */
  +    protected SAXParser () {
  +    
  +    }
  +
  +	/**
  +	 * <p>Reset this <code>SAXParser</code> to its original configuration.</p>
  +	 * 
  +	 * <p><code>SAXParser</code> is reset to the same state as when it was created with
  +	 * {@link SAXParserFactory#newSAXParser()}.
  +	 * <code>reset()</code> is designed to allow the reuse of existing <code>SAXParser</code>s
  +	 * thus saving resources associated with the creation of new <code>SAXParser</code>s.</p>
  +	 * 
  +	 * <p>The reset <code>SAXParser</code> is not guaranteed to have the same {@link Schema}
  +	 * <code>Object</code>, e.g. {@link Object#equals(Object obj)}.  It is guaranteed to have a functionally equal
  +	 * <code>Schema</code>.</p>
  +	 * 
  +	 * @since 1.5
  +	 */
  +	public void reset() {
  +
  +		// implementors should override this method
  +		throw new UnsupportedOperationException(
  +			"This SAXParser, \"" + this.getClass().getName() + "\", does not support the reset functionality."
  +			+ "  Specification \"" + this.getClass().getPackage().getSpecificationTitle() + "\""
  +			+ " version \"" + this.getClass().getPackage().getSpecificationVersion() + "\""
  +			);
  +	}
  +
  +    /**
  +     * <p>Parse the content of the given {@link java.io.InputStream}
  +     * instance as XML using the specified {@link org.xml.sax.HandlerBase}.
  +     * <i> Use of the DefaultHandler version of this method is recommended as
  +     * the HandlerBase class has been deprecated in SAX 2.0</i>.</p>
  +     *
  +     * @param is InputStream containing the content to be parsed.
  +     * @param hb The SAX HandlerBase to use.
  +     * 
  +     * @throws IllegalArgumentException If the given InputStream is null.
  +     * @throws SAXException If parse produces a SAX error.
  +     * @throws IOException If an IO error occurs interacting with the
  +     *   <code>InputStream</code>.
  +     * 
  +     * @see org.xml.sax.DocumentHandler
  +     */    
  +    public void parse(InputStream is, HandlerBase hb)
  +        throws SAXException, IOException {
  +        if (is == null) {
  +            throw new IllegalArgumentException("InputStream cannot be null");
  +        }
  +
  +        InputSource input = new InputSource(is);
  +        this.parse(input, hb);
  +    }
  +
  +    /**
  +     * <p>Parse the content of the given {@link java.io.InputStream}
  +     * instance as XML using the specified {@link org.xml.sax.HandlerBase}.
  +     * <i> Use of the DefaultHandler version of this method is recommended as
  +     * the HandlerBase class has been deprecated in SAX 2.0</i>.</p>
  +     *
  +     * @param is InputStream containing the content to be parsed.
  +     * @param hb The SAX HandlerBase to use.
  +     * @param systemId The systemId which is needed for resolving relative URIs.
  +     * 
  +     * @throws IllegalArgumentException If the given <code>InputStream</code> is
  +     *   <code>null</code>.
  +     * @throws IOException If any IO error occurs interacting with the
  +     *   <code>InputStream</code>.
  +     * @throws SAXException If any SAX errors occur during processing.
  +     * 
  +     * @see org.xml.sax.DocumentHandler version of this method instead.
  +     */
  +    public void parse(
  +        InputStream is,
  +        HandlerBase hb,
  +        String systemId)
  +        throws SAXException, IOException {
  +        if (is == null) {
  +            throw new IllegalArgumentException("InputStream cannot be null");
  +        }
  +
  +        InputSource input = new InputSource(is);
  +        input.setSystemId(systemId);
  +        this.parse(input, hb);
  +    }
  +   
  +    /**
  +     * Parse the content of the given {@link java.io.InputStream}
  +     * instance as XML using the specified
  +     * {@link org.xml.sax.helpers.DefaultHandler}.
  +     *
  +     * @param is InputStream containing the content to be parsed.
  +     * @param dh The SAX DefaultHandler to use.
  +     * 
  +     * @throws IllegalArgumentException If the given InputStream is null.
  +     * @throws IOException If any IO errors occur.
  +     * @throws SAXException If any SAX errors occur during processing.
  +     * 
  +     * @see org.xml.sax.DocumentHandler
  +     */
  +    public void parse(InputStream is, DefaultHandler dh)
  +        throws SAXException, IOException {
  +        if (is == null) {
  +            throw new IllegalArgumentException("InputStream cannot be null");
  +        }
  +
  +        InputSource input = new InputSource(is);
  +        this.parse(input, dh);
  +    }
  +
  +    /**
  +     * Parse the content of the given {@link java.io.InputStream}
  +     * instance as XML using the specified
  +     * {@link org.xml.sax.helpers.DefaultHandler}.
  +     *
  +     * @param is InputStream containing the content to be parsed.
  +     * @param dh The SAX DefaultHandler to use.
  +     * @param systemId The systemId which is needed for resolving relative URIs.
  +     * 
  +     * @throws IllegalArgumentException If the given InputStream is null.
  +     * @throws IOException If any IO errors occur.
  +     * @throws SAXException If any SAX errors occur during processing.
  +     * 
  +     * @see org.xml.sax.DocumentHandler version of this method instead.
  +     */
  +    public void parse(
  +        InputStream is,
  +        DefaultHandler dh,
  +        String systemId)
  +        throws SAXException, IOException {
  +        if (is == null) {
  +            throw new IllegalArgumentException("InputStream cannot be null");
  +        }
  +
  +        InputSource input = new InputSource(is);
  +        input.setSystemId(systemId);
  +        this.parse(input, dh);
  +    }
  +
  +    /**
  +     * Parse the content described by the giving Uniform Resource
  +     * Identifier (URI) as XML using the specified
  +     * {@link org.xml.sax.HandlerBase}.
  +     * <i> Use of the DefaultHandler version of this method is recommended as
  +     * the <code>HandlerBase</code> class has been deprecated in SAX 2.0</i>
  +     *
  +     * @param uri The location of the content to be parsed.
  +     * @param hb The SAX HandlerBase to use.
  +     * 
  +     * @throws IllegalArgumentException If the uri is null.
  +     * @throws IOException If any IO errors occur.
  +     * @throws SAXException If any SAX errors occur during processing.
  +     * 
  +     * @see org.xml.sax.DocumentHandler
  +     */
  +    public void parse(String uri, HandlerBase hb)
  +        throws SAXException, IOException {
  +        if (uri == null) {
  +            throw new IllegalArgumentException("uri cannot be null");
  +        }
  +
  +        InputSource input = new InputSource(uri);
  +        this.parse(input, hb);
  +    }
  +  
  +    /**
  +     * Parse the content described by the giving Uniform Resource
  +     * Identifier (URI) as XML using the specified
  +     * {@link org.xml.sax.helpers.DefaultHandler}.
  +     *
  +     * @param uri The location of the content to be parsed.
  +     * @param dh The SAX DefaultHandler to use.
  +     * 
  +     * @throws IllegalArgumentException If the uri is null.
  +     * @throws IOException If any IO errors occur.
  +     * @throws SAXException If any SAX errors occur during processing.
  +     * 
  +     * @see org.xml.sax.DocumentHandler
  +     */   
  +    public void parse(String uri, DefaultHandler dh)
  +        throws SAXException, IOException {
  +        if (uri == null) {
  +            throw new IllegalArgumentException("uri cannot be null");
  +        }
  +
  +        InputSource input = new InputSource(uri);
  +        this.parse(input, dh);
  +    }
  +    
  +    /**
  +     * Parse the content of the file specified as XML using the
  +     * specified {@link org.xml.sax.HandlerBase}.
  +     * <i> Use of the DefaultHandler version of this method is recommended as
  +     * the HandlerBase class has been deprecated in SAX 2.0</i>
  +     *
  +     * @param f The file containing the XML to parse
  +     * @param hb The SAX HandlerBase to use.
  +     * 
  +     * @throws IllegalArgumentException If the File object is null.
  +     * @throws IOException If any IO errors occur.
  +     * @throws SAXException If any SAX errors occur during processing.
  +     * 
  +     * @see org.xml.sax.DocumentHandler
  +     */
  +    public void parse(File f, HandlerBase hb)
  +        throws SAXException, IOException {
  +        if (f == null) {
  +            throw new IllegalArgumentException("File cannot be null");
  +        }
  +        
  +        String escapedURI = FilePathToURI.filepath2URI(f.getAbsolutePath());
  +
  +        if (DEBUG) {
  +            System.out.println("Escaped URI = " + escapedURI);
  +        }
  +
  +        InputSource input = new InputSource(escapedURI);
  +        this.parse(input, hb);
  +    }
  +    
  +    /**
  +     * Parse the content of the file specified as XML using the
  +     * specified {@link org.xml.sax.helpers.DefaultHandler}.
  +     *
  +     * @param f The file containing the XML to parse
  +     * @param dh The SAX DefaultHandler to use.
  +     * 
  +     * @throws IllegalArgumentException If the File object is null.
  +     * @throws IOException If any IO errors occur.
  +     * @throws SAXException If any SAX errors occur during processing.
  +     * 
  +     * @see org.xml.sax.DocumentHandler
  +     */
  +    public void parse(File f, DefaultHandler dh)
  +        throws SAXException, IOException {
  +        if (f == null) {
  +            throw new IllegalArgumentException("File cannot be null");
  +        }
  +        
  +        String escapedURI = FilePathToURI.filepath2URI(f.getAbsolutePath());
  +
  +        if (DEBUG) {
  +            System.out.println("Escaped URI = " + escapedURI);
  +        }
  +
  +        InputSource input = new InputSource(escapedURI);
  +        this.parse(input, dh);
  +    }
  +    
  +    /**
  +     * Parse the content given {@link org.xml.sax.InputSource}
  +     * as XML using the specified
  +     * {@link org.xml.sax.HandlerBase}.
  +     * <i> Use of the DefaultHandler version of this method is recommended as
  +     * the HandlerBase class has been deprecated in SAX 2.0</i>
  +     *
  +     * @param is The InputSource containing the content to be parsed.
  +     * @param hb The SAX HandlerBase to use.
  +     * 
  +     * @throws IllegalArgumentException If the <code>InputSource</code> object
  +     *   is <code>null</code>.
  +     * @throws IOException If any IO errors occur.
  +     * @throws SAXException If any SAX errors occur during processing.
  +     * 
  +     * @see org.xml.sax.DocumentHandler
  +     */
  +    public void parse(InputSource is, HandlerBase hb)
  +        throws SAXException, IOException {
  +        if (is == null) {
  +            throw new IllegalArgumentException("InputSource cannot be null");
  +        }
  +
  +        Parser parser = this.getParser();
  +        if (hb != null) {
  +            parser.setDocumentHandler(hb);
  +            parser.setEntityResolver(hb);
  +            parser.setErrorHandler(hb);
  +            parser.setDTDHandler(hb);
  +        }
  +        parser.parse(is);
  +    }
  +    
  +    /**
  +     * Parse the content given {@link org.xml.sax.InputSource}
  +     * as XML using the specified
  +     * {@link org.xml.sax.helpers.DefaultHandler}.
  +     *
  +     * @param is The InputSource containing the content to be parsed.
  +     * @param dh The SAX DefaultHandler to use.
  +     * 
  +     * @throws IllegalArgumentException If the <code>InputSource</code> object
  +     *   is <code>null</code>.
  +     * @throws IOException If any IO errors occur.
  +     * @throws SAXException If any SAX errors occur during processing.
  +     * 
  +     * @see org.xml.sax.DocumentHandler
  +     */
  +    public void parse(InputSource is, DefaultHandler dh)
  +        throws SAXException, IOException {
  +        if (is == null) {
  +            throw new IllegalArgumentException("InputSource cannot be null");
  +        }
  +
  +        XMLReader reader = this.getXMLReader();
  +        if (dh != null) {
  +            reader.setContentHandler(dh);
  +            reader.setEntityResolver(dh);
  +            reader.setErrorHandler(dh);
  +            reader.setDTDHandler(dh);
  +        }
  +        reader.parse(is);
  +    }
  +    
  +    /**
  +     * Returns the SAX parser that is encapsultated by the
  +     * implementation of this class.
  +     *
  +     * @return The SAX parser that is encapsultated by the
  +     *         implementation of this class.
  +     * 
  +     * @throws SAXException If any SAX errors occur during processing.
  +     */
  +    public abstract org.xml.sax.Parser getParser() throws SAXException;
  +
  +    /**
  +     * Returns the {@link org.xml.sax.XMLReader} that is encapsulated by the
  +     * implementation of this class.
  +     *
  +     * @return The XMLReader that is encapsulated by the
  +     *         implementation of this class.
  +     * 
  +     * @throws SAXException If any SAX errors occur during processing.
  +     */
  +
  +    public abstract org.xml.sax.XMLReader getXMLReader() throws SAXException;
  +    
  +    /**
  +     * Indicates whether or not this parser is configured to
  +     * understand namespaces.
  +     *
  +     * @return true if this parser is configured to
  +     *         understand namespaces; false otherwise.
  +     */
  +    
  +    public abstract boolean isNamespaceAware();
  +
  +    /**
  +     * Indicates whether or not this parser is configured to
  +     * validate XML documents.
  +     *
  +     * @return true if this parser is configured to
  +     *         validate XML documents; false otherwise.
  +     */
  +    
  +    public abstract boolean isValidating();
  +
  +    /**
  +     * <p>Sets the particular property in the underlying implementation of
  +     * {@link org.xml.sax.XMLReader}.
  +     * A list of the core features and properties can be found at
  +     * <a href="http://sax.sourceforge.net/?selected=get-set">
  +     * http://sax.sourceforge.net/?selected=get-set</a>.</p>
  +     *
  +     * @param name The name of the property to be set.
  +     * @param value The value of the property to be set.
  +     * 
  +     * @throws SAXNotRecognizedException When the underlying XMLReader does
  +     *   not recognize the property name.
  +     * @throws SAXNotSupportedException When the underlying XMLReader
  +     *  recognizes the property name but doesn't support the property.
  +     *
  +     * @see org.xml.sax.XMLReader#setProperty
  +     */
  +    public abstract void setProperty(String name, Object value)
  +        throws SAXNotRecognizedException, SAXNotSupportedException;
  +
  +    /**
  +     * <p>Returns the particular property requested for in the underlying
  +     * implementation of {@link org.xml.sax.XMLReader}.</p>
  +     *
  +     * @param name The name of the property to be retrieved.
  +     * @return Value of the requested property.
  +     *
  +     * @throws SAXNotRecognizedException When the underlying XMLReader does
  +     *    not recognize the property name.
  +     * @throws SAXNotSupportedException When the underlying XMLReader
  +     *  recognizes the property name but doesn't support the property.
  +     *
  +     * @see org.xml.sax.XMLReader#getProperty
  +     */
  +    public abstract Object getProperty(String name)
  +        throws SAXNotRecognizedException, SAXNotSupportedException;
  +
  +    /** <p>Get current state of canonicalization.</p>
  +     *
  +     * @return current state canonicalization control
  +     */
  +    /*
  +    public boolean getCanonicalization() {
  +        return canonicalState;
  +    }    
  +    */
  +
  +    /** <p>Get a reference to the the {@link Schema} being used by
  +     * the XML processor.</p>
  +     *
  +     * <p>If no schema is being used, <code>null</code> is returned.</p>
  +     *
  +     * @return {@link Schema} being used or <code>null</code>
  +     *  if none in use
  +     * 
  +     * @throws UnsupportedOperationException
  +     *      For backward compatibility, when implementations for
  +     *      earlier versions of JAXP is used, this exception will be
  +     *      thrown.
  +     * 
  +     * @since 1.5
  +     */
  +    public Schema getSchema() {
  +        throw new UnsupportedOperationException(
  +            "This parser does not support specification \""
  +            + this.getClass().getPackage().getSpecificationTitle()
  +            + "\" version \""
  +            + this.getClass().getPackage().getSpecificationVersion()
  +            + "\""
  +            );
  +    }
  +    
  +    /**
  +     * <p>Get the XInclude processing mode for this parser.</p>
  +     * 
  +     * @return
  +     *      the return value of
  +     *      the {@link SAXParserFactory#isXIncludeAware()}
  +     *      when this parser was created from factory.
  +     * 
  +     * @throws UnsupportedOperationException
  +     *      For backward compatibility, when implementations for
  +     *      earlier versions of JAXP is used, this exception will be
  +     *      thrown.
  +     * 
  +     * @since 1.5
  +     * 
  +     * @see SAXParserFactory#setXIncludeAware(boolean)
  +     */
  +    public boolean isXIncludeAware() {
  +        throw new UnsupportedOperationException(
  +            "This parser does not support specification \""
  +            + this.getClass().getPackage().getSpecificationTitle()
  +            + "\" version \""
  +            + this.getClass().getPackage().getSpecificationVersion()
  +            + "\""
  +            );
  +    }
  +}