xerces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From edwi...@apache.org
Subject cvs commit: xml-xerces/java/src/javax/xml/parsers DocumentBuilderFactory.java DocumentBuilder.java
Date Fri, 02 Feb 2001 23:07:11 GMT
edwingo     01/02/02 15:07:10

  Modified:    java/src/org/apache/xerces/jaxp Tag: xerces_j_2
                        SAXParserImpl.java SAXParserFactoryImpl.java
                        DocumentBuilderImpl.java
                        DocumentBuilderFactoryImpl.java
               java/src/javax/xml/parsers Tag: xerces_j_2
                        DocumentBuilderFactory.java DocumentBuilder.java
  Added:       java/src/org/apache/xerces/jaxp Tag: xerces_j_2
                        DefaultValidationErrorHandler.java
  Log:
  Implementation of parsing component (javax.xml.parsers) of JAXP 1.1
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.1.4.2   +93 -63    xml-xerces/java/src/org/apache/xerces/jaxp/SAXParserImpl.java
  
  Index: SAXParserImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/jaxp/SAXParserImpl.java,v
  retrieving revision 1.1.4.1
  retrieving revision 1.1.4.2
  diff -u -r1.1.4.1 -r1.1.4.2
  --- SAXParserImpl.java	2000/12/12 19:07:48	1.1.4.1
  +++ SAXParserImpl.java	2001/02/02 23:06:52	1.1.4.2
  @@ -1,4 +1,6 @@
   /*
  + * $Id: SAXParserImpl.java,v 1.1.4.2 2001/02/02 23:06:52 edwingo Exp $
  + *
    * The Apache Software License, Version 1.1
    *
    *
  @@ -49,100 +51,129 @@
    *
    * This software consists of voluntary contributions made by many
    * individuals on behalf of the Apache Software Foundation and was
  - * originally based on software copyright (c) 1999-2000, Pierpaolo
  - * Fumagalli <mailto:pier@betaversion.org>, http://www.apache.org.
  - * For more information on the Apache Software Foundation, please see
  - * <http://www.apache.org/>.
  + * originally based on software copyright (c) 1999, Sun Microsystems, Inc., 
  + * http://www.sun.com.  For more information on the Apache Software 
  + * Foundation, please see <http://www.apache.org/>.
    */
   
   package org.apache.xerces.jaxp;
   
  -import java.io.File;
  -import java.io.InputStream;
  -import java.io.IOException;
  +import javax.xml.parsers.SAXParser;
  +import javax.xml.parsers.SAXParserFactory;
   import javax.xml.parsers.ParserConfigurationException;
  -import org.apache.xerces.parsers.SAXParser;
  +
  +import org.xml.sax.SAXException;
  +import org.xml.sax.SAXParseException;
   import org.xml.sax.HandlerBase;
  -import org.xml.sax.InputSource;
   import org.xml.sax.Parser;
   import org.xml.sax.XMLReader;
  -import org.xml.sax.SAXException;
  +import org.xml.sax.helpers.XMLReaderFactory;
  +import org.xml.sax.helpers.XMLReaderAdapter;
  +import org.xml.sax.helpers.DefaultHandler;
   import org.xml.sax.SAXNotRecognizedException;
   import org.xml.sax.SAXNotSupportedException;
   
  +import java.util.*;
  +
   /**
  - * The <code>SAXParser</code> implementation for the Apache Xerces XML parser.
  - *
  - * @author <a href="mailto:fumagalli@exoffice.com">Pierpaolo Fumagalli</a>
  - *         (Apache Software Foundation, Exoffice Technologies)
  - * @version $Revision: 1.1.4.1 $ $Date: 2000/12/12 19:07:48 $
  + * @author Rajiv Mordani
  + * @author Edwin Goei
  + * @version $Revision: 1.1.4.2 $
    */
  -public class SAXParserImpl extends javax.xml.parsers.SAXParser {
   
  -    /** Wether this <code>SAXParserImpl</code> supports namespaces. */
  -    private boolean namespaces=false;
  -    /** Wether this <code>SAXParserImpl</code> supports validataion. */
  -    private boolean validation=false;
  -    /** The current Xerces SAX <code>Parser</code>. */
  -    private Parser parser=null;
  -
  -    /** Deny no-argument construction. */
  -    private SAXParserImpl() {
  -        super();
  -    }
  -
  +/**
  + * This is the implementation specific class for the
  + * <code>javax.xml.parsers.SAXParser</code>. 
  + */
  +public class SAXParserImpl extends SAXParser {
  +    /** Default parser name. */
  +    static final String DEFAULT_PARSER_NAME =
  +                                    "org.apache.xerces.parsers.SAXParser";
  +
  +    private SAXParserFactory spf = null;
  +    private XMLReader xmlReader;
  +    private Parser parser = null;
  +
  +    private boolean validating = false;
  +    private boolean namespaceAware = false;
  +    
       /**
  -     * Create a new <code>SAXParserFactoryImpl</code> instance.
  +     * Create a SAX parser with the associated features
  +     * @param features Hashtable of SAX features, may be null
        */
  -    protected SAXParserImpl(boolean namespaces, boolean validation)
  -    throws ParserConfigurationException {
  -        this();
  -        SAXParser p=new SAXParser();
  -        try {
  -            p.setFeature("http://xml.org/sax/features/namespaces",namespaces);
  -        } catch (SAXException e) {
  -            throw new ParserConfigurationException("Cannot set namespace "+
  -                "awareness to "+namespaces);
  +    SAXParserImpl(SAXParserFactory spf, Hashtable features)
  +        throws SAXException
  +    {
  +        xmlReader = XMLReaderFactory.createXMLReader(DEFAULT_PARSER_NAME);
  +
  +        // Validation
  +        validating = spf.isValidating();
  +        String validation = "http://xml.org/sax/features/validation";
  +
  +        // If validating, provide a default ErrorHandler that prints
  +        // validation errors with a warning telling the user to set an
  +        // ErrorHandler.  Note: this does not handle all cases.
  +        if (validating) {
  +            xmlReader.setErrorHandler(new DefaultValidationErrorHandler());
           }
  -        try {
  -            p.setFeature("http://xml.org/sax/features/validation",validation);
  -        } catch (SAXException e) {
  -            throw new ParserConfigurationException("Cannot set validation to "+
  -                validation);
  +
  +        // Allow SAX parser to use a different ErrorHandler if it wants to
  +        xmlReader.setFeature(validation, validating);
  +
  +        if (spf.isNamespaceAware()) {
  +            namespaceAware = true;
  +	    // XXX default value of namespaceAware conflicts with SAX2
  +	    // namespaces feature so do nothing for now
           }
  -        this.namespaces=namespaces;
  -        this.validation=validation;
  -        this.parser=p;
  +
  +        setFeatures(features);
       }
   
       /**
  -     * Returns the underlying <code>Parser</code> object which is wrapped by
  -     * this <code>SAXParserImpl</code> implementation.
  +     * Set any features of our XMLReader based on any features set on the
  +     * SAXParserFactory.
  +     *
  +     * XXX Does not handle possible conflicts between SAX feature names and
  +     * JAXP specific feature names, eg. SAXParserFactory.isValidating()
        */
  -    public Parser getParser() {
  -        return(this.parser);
  +    private void setFeatures(Hashtable features)
  +        throws SAXNotSupportedException, SAXNotRecognizedException
  +    {
  +        if (features != null) {
  +            for (Enumeration e = features.keys(); e.hasMoreElements();) {
  +                String feature = (String)e.nextElement();
  +                boolean value = ((Boolean)features.get(feature)).booleanValue();
  +                xmlReader.setFeature(feature, value);
  +            }
  +        }
  +    }
  +
  +    public Parser getParser() throws SAXException {
  +        if (parser == null) {
  +            // Adapt a SAX2 XMLReader into a SAX1 Parser
  +            parser = new XMLReaderAdapter(xmlReader);
  +
  +            // Set a DocumentHandler that does nothing to avoid getting
  +            // exceptions if no DocumentHandler is set by the app
  +            parser.setDocumentHandler(new HandlerBase());
  +        }
  +        return parser;
       }
   
       /**
        * Returns the XMLReader that is encapsulated by the implementation of
        * this class.
        */
  -    public XMLReader getXMLReader() throws SAXException {
  -        return (XMLReader)parser; // xerces implements both parser and reader.
  +    public XMLReader getXMLReader() {
  +        return xmlReader;
       }
   
  -    /**
  -     * Returns whether or not this parser supports XML namespaces.
  -     */
       public boolean isNamespaceAware() {
  -        return(this.namespaces);
  +        return namespaceAware;
       }
   
  -    /**
  -     * Returns whether or not this parser supports validating XML content.
  -     */
       public boolean isValidating() {
  -        return(this.validation);
  +        return validating;
       }
   
       /**
  @@ -152,7 +183,7 @@
       public void setProperty(String name, Object value)
           throws SAXNotRecognizedException, SAXNotSupportedException
       {
  -        throw new SAXNotRecognizedException("Feature: " + name);
  +        xmlReader.setProperty(name, value);
       }
   
       /**
  @@ -162,7 +193,6 @@
       public Object getProperty(String name)
           throws SAXNotRecognizedException, SAXNotSupportedException
       {
  -        throw new SAXNotRecognizedException("Feature: " + name);
  +        return xmlReader.getProperty(name);
       }
  -
   }
  
  
  
  1.1.4.2   +63 -22    xml-xerces/java/src/org/apache/xerces/jaxp/SAXParserFactoryImpl.java
  
  Index: SAXParserFactoryImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/jaxp/SAXParserFactoryImpl.java,v
  retrieving revision 1.1.4.1
  retrieving revision 1.1.4.2
  diff -u -r1.1.4.1 -r1.1.4.2
  --- SAXParserFactoryImpl.java	2000/12/12 19:07:48	1.1.4.1
  +++ SAXParserFactoryImpl.java	2001/02/02 23:06:54	1.1.4.2
  @@ -1,4 +1,6 @@
   /*
  + * $Id: SAXParserFactoryImpl.java,v 1.1.4.2 2001/02/02 23:06:54 edwingo Exp $
  + *
    * The Apache Software License, Version 1.1
    *
    *
  @@ -49,44 +51,74 @@
    *
    * This software consists of voluntary contributions made by many
    * individuals on behalf of the Apache Software Foundation and was
  - * originally based on software copyright (c) 1999-2000, Pierpaolo
  - * Fumagalli <mailto:pier@betaversion.org>, http://www.apache.org.
  - * For more information on the Apache Software Foundation, please see
  - * <http://www.apache.org/>.
  + * originally based on software copyright (c) 1999, Sun Microsystems, Inc., 
  + * http://www.sun.com.  For more information on the Apache Software 
  + * Foundation, please see <http://www.apache.org/>.
    */
   
  +
   package org.apache.xerces.jaxp;
   
  -import javax.xml.parsers.ParserConfigurationException;
  -import javax.xml.parsers.SAXParser;
   import javax.xml.parsers.SAXParserFactory;
  +import javax.xml.parsers.SAXParser;
  +import javax.xml.parsers.ParserConfigurationException;
   import org.xml.sax.SAXException;
   import org.xml.sax.SAXNotRecognizedException;
   import org.xml.sax.SAXNotSupportedException;
  +import org.xml.sax.XMLReader;
  +
  +import java.util.Hashtable;
   
   /**
  - * The <code>SAXParserFactory</code> implementation for the Apache Xerces
  - * XML parser.
  - *
  - * @author <a href="mailto:fumagalli@exoffice.com">Pierpaolo Fumagalli</a>
  - *         (Apache Software Foundation, Exoffice Technologies)
  - * @version $Revision: 1.1.4.1 $ $Date: 2000/12/12 19:07:48 $
  + * @author Rajiv Mordani
  + * @author Edwin Goei
  + * @version $Revision: 1.1.4.2 $
  + */
  +
  +/**
  + * This is the implementation specific class for the
  + * <code>javax.xml.parsers.SAXParserFactory</code>. This is the platform
  + * default implementation for the platform.
    */
   public class SAXParserFactoryImpl extends SAXParserFactory {
  +    private Hashtable features;
   
       /**
  -     * Create a new <code>SAXParserFactoryImpl</code> instance.
  +     * Creates a new instance of <code>SAXParser</code> using the currently
  +     * configured factory parameters.
  +     * @return javax.xml.parsers.SAXParser
        */
  -    public SAXParserFactoryImpl() {
  -        super();
  +    public SAXParser newSAXParser()
  +        throws ParserConfigurationException
  +    {
  +        SAXParser saxParserImpl;
  +        try {
  +            saxParserImpl = new SAXParserImpl(this, features);
  +        } catch (SAXException se) {
  +            // Translate to ParserConfigurationException
  +            throw new ParserConfigurationException(se.getMessage());
  +        }
  +	return saxParserImpl;
       }
   
       /**
  -     * Returns a new configured instance of type <code>SAXParser</code>.
  +     * Common code for translating exceptions
        */
  -    public SAXParser newSAXParser()
  -    throws ParserConfigurationException {
  -        return(new SAXParserImpl(this.isNamespaceAware(),this.isValidating()));
  +    private SAXParserImpl newSAXParserImpl()
  +        throws ParserConfigurationException, SAXNotRecognizedException, 
  +        SAXNotSupportedException
  +    {
  +        SAXParserImpl saxParserImpl;
  +        try {
  +            saxParserImpl = new SAXParserImpl(this, features);
  +        } catch (SAXNotSupportedException e) {
  +            throw e;
  +        } catch (SAXNotRecognizedException e) {
  +            throw e;
  +        } catch (SAXException se) {
  +            throw new ParserConfigurationException(se.getMessage());
  +        }
  +        return saxParserImpl;
       }
   
       /**
  @@ -97,7 +129,15 @@
           throws ParserConfigurationException, SAXNotRecognizedException, 
   		SAXNotSupportedException
       {
  -        throw new SAXNotRecognizedException("Feature: " + name);
  +        // XXX This is ugly.  We have to collect the features and then
  +        // later create an XMLReader to verify the features.
  +        if (features == null) {
  +            features = new Hashtable();
  +        }
  +        features.put(name, new Boolean(value));
  +
  +        // Test the feature by possibly throwing SAX exceptions
  +        newSAXParserImpl();
       }
   
       /**
  @@ -108,7 +148,8 @@
           throws ParserConfigurationException, SAXNotRecognizedException,
   		SAXNotSupportedException
       {
  -        throw new SAXNotRecognizedException("Feature: " + name);
  +        // Check for valid name by creating a dummy XMLReader to get
  +        // feature value
  +        return newSAXParserImpl().getXMLReader().getFeature(name);
       }
  -
   }
  
  
  
  1.1.4.2   +106 -78   xml-xerces/java/src/org/apache/xerces/jaxp/DocumentBuilderImpl.java
  
  Index: DocumentBuilderImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/jaxp/DocumentBuilderImpl.java,v
  retrieving revision 1.1.4.1
  retrieving revision 1.1.4.2
  diff -u -r1.1.4.1 -r1.1.4.2
  --- DocumentBuilderImpl.java	2000/12/12 19:07:48	1.1.4.1
  +++ DocumentBuilderImpl.java	2001/02/02 23:06:55	1.1.4.2
  @@ -1,4 +1,6 @@
   /*
  + * $Id: DocumentBuilderImpl.java,v 1.1.4.2 2001/02/02 23:06:55 edwingo Exp $
  + *
    * The Apache Software License, Version 1.1
    *
    *
  @@ -49,117 +51,143 @@
    *
    * This software consists of voluntary contributions made by many
    * individuals on behalf of the Apache Software Foundation and was
  - * originally based on software copyright (c) 1999-2000, Pierpaolo
  - * Fumagalli <mailto:pier@betaversion.org>, http://www.apache.org.
  - * For more information on the Apache Software Foundation, please see
  - * <http://www.apache.org/>.
  + * originally based on software copyright (c) 1999, Sun Microsystems, Inc., 
  + * http://www.sun.com.  For more information on the Apache Software 
  + * Foundation, please see <http://www.apache.org/>.
    */
   
  +
   package org.apache.xerces.jaxp;
   
   import java.io.IOException;
   import javax.xml.parsers.DocumentBuilder;
  +import javax.xml.parsers.DocumentBuilderFactory;
   import javax.xml.parsers.ParserConfigurationException;
  -import org.apache.xerces.parsers.DOMParser;
  -import org.xml.sax.EntityResolver;
  -import org.xml.sax.ErrorHandler;
  +
  +import org.w3c.dom.Document;
  +import org.w3c.dom.DOMImplementation;
  +import org.w3c.dom.DocumentType;
  +
  +import org.xml.sax.XMLReader;
   import org.xml.sax.InputSource;
   import org.xml.sax.SAXException;
  -import org.w3c.dom.Document;
  +import org.xml.sax.SAXParseException;
  +import org.xml.sax.EntityResolver;
  +import org.xml.sax.ErrorHandler;
  +import org.xml.sax.helpers.DefaultHandler;
   
  +import org.apache.xerces.parsers.DOMParser;
  +import org.apache.xerces.dom.DOMImplementationImpl;
  +
   /**
  - * The <code>DocumentBuilder</code> implementation for the Apache Xerces XML
  - * parser.
  - *
  - * @author <a href="mailto:fumagalli@exoffice.com">Pierpaolo Fumagalli</a>
  - *         (Apache Software Foundation, Exoffice Technologies)
  - * @version $Revision: 1.1.4.1 $ $Date: 2000/12/12 19:07:48 $
  + * @author Rajiv Mordani
  + * @author Edwin Goei
  + * @version $Revision: 1.1.4.2 $
    */
   public class DocumentBuilderImpl extends DocumentBuilder {
  +    /** Xerces features */
  +    static final String XERCES_FEATURE_PREFIX =
  +                                        "http://apache.org/xml/features/";
  +    static final String CREATE_ENTITY_REF_NODES_FEATURE =
  +                                        "dom/create-entity-ref-nodes";
  +    static final String INCLUDE_IGNORABLE_WHITESPACE =
  +                                        "dom/include-ignorable-whitespace";
  +
  +    private DocumentBuilderFactory dbf;
  +
  +    private EntityResolver er = null;
  +    private ErrorHandler eh = null;
  +    private DOMParser domParser = null;
  +
  +    private boolean namespaceAware = false;
  +    private boolean validating = false;
  +
  +    DocumentBuilderImpl(DocumentBuilderFactory dbf)
  +        throws ParserConfigurationException
  +    {
  +        this.dbf = dbf;
   
  -    /** Wether this <code>SAXParserImpl</code> supports namespaces. */
  -    private boolean namespaces=false;
  -    /** Wether this <code>SAXParserImpl</code> supports validataion. */
  -    private boolean validation=false;
  -    /** The current Xerces SAX <code>Parser</code>. */
  -    private DOMParser parser=null;
  -
  -    /** Deny no-argument construction. */
  -    private DocumentBuilderImpl() {
  -        super();
  -    }
  +        domParser = new DOMParser();
   
  -    /**
  -     * Create a new <code>SAXParserFactoryImpl</code> instance.
  -     */
  -    protected DocumentBuilderImpl(boolean namespaces, boolean validation)
  -    throws ParserConfigurationException {
  -        this();
  -        DOMParser p=new DOMParser();
           try {
  -            p.setFeature("http://xml.org/sax/features/namespaces",namespaces);
  +            // Validation
  +            validating = dbf.isValidating();
  +            String validation = "http://xml.org/sax/features/validation";
  +
  +            // If validating, provide a default ErrorHandler that prints
  +            // validation errors with a warning telling the user to set an
  +            // ErrorHandler
  +            if (validating) {
  +                domParser.setErrorHandler(new DefaultValidationErrorHandler());
  +            }
  +            // Allow parser to use a different ErrorHandler if it wants to
  +            domParser.setFeature(validation, validating);
  +
  +            // XXX Ignore unimplemented features for now
  +            try {
  +                // Set various parameters obtained from DocumentBuilderFactory
  +                domParser.setFeature(XERCES_FEATURE_PREFIX +
  +                                     INCLUDE_IGNORABLE_WHITESPACE,
  +                                     !dbf.isIgnoringElementContentWhitespace());
  +                domParser.setFeature(XERCES_FEATURE_PREFIX +
  +                                     CREATE_ENTITY_REF_NODES_FEATURE,
  +                                     !dbf.isExpandEntityReferences());
  +                // XXX No way to control dbf.isIgnoringComments() or
  +                // dbf.isCoalescing()
  +            } catch (SAXException e) {
  +            }
           } catch (SAXException e) {
  -            throw new ParserConfigurationException("Cannot set namespace "+
  -                "awareness to "+namespaces);
  +            // Handles both SAXNotSupportedException, SAXNotRecognizedException
  +            throw new ParserConfigurationException(e.getMessage());
           }
  -        try {
  -            p.setFeature("http://xml.org/sax/features/validation",validation);
  -        } catch (SAXException e) {
  -            throw new ParserConfigurationException("Cannot set validation to "+
  -                validation);
  -        }
  -        this.namespaces=namespaces;
  -        this.validation=validation;
  -        this.parser=p;
       }
   
       /**
  -     * Parses the content of the given <code>InputSource</code> and returns
  -     * a <code>Document</code> object.
  +     * Non-preferred: use the getDOMImplementation() method instead of this
  +     * one
        */
  -    public Document parse(InputSource source)
  -    throws SAXException, IOException, IllegalArgumentException {
  -        if (source==null) throw new IllegalArgumentException();
  -        this.parser.parse(source);
  -        return(this.parser.getDocument());
  +    public Document newDocument() {
  +        DOMImplementation di = getDOMImplementation();
  +        // XXX What should the root element be named???
  +        String qName = "root";
  +        DocumentType docType = di.createDocumentType(qName, null, null);
  +        return di.createDocument(null, qName, docType);
       }
   
  -    /**
  -     * Creates an new <code>Document</code> instance from the underlying DOM
  -     * implementation.
  -     */
  -    public Document newDocument() {
  -        return(new org.apache.xerces.dom.DocumentImpl());
  +    public DOMImplementation getDOMImplementation() {
  +        return DOMImplementationImpl.getDOMImplementation();
       }
   
  -    /**
  -     * Returns whether or not this parser supports XML namespaces.
  -     */
  +    public Document parse(InputSource is) throws SAXException, IOException {
  +        if (is == null) {
  +            throw new IllegalArgumentException("InputSource cannot be null");
  +        }
  +
  +        if (er != null) {
  +            domParser.setEntityResolver(er);
  +        }
  +
  +        if (eh != null) {
  +            domParser.setErrorHandler(eh);      
  +        }
  +
  +        domParser.parse(is);
  +        return domParser.getDocument();
  +    }
  +
       public boolean isNamespaceAware() {
  -        return(this.namespaces);
  +        return namespaceAware;
       }
   
  -    /**
  -     * Returns whether or not this parser supports validating XML content.
  -     */
       public boolean isValidating() {
  -        return(this.validation);
  +        return validating;
       }
   
  -    /**
  -     * Specifies the <code>EntityResolver</code> to be used by this
  -     * <code>DocumentBuilderImpl</code>.
  -     */
  -    public void setEntityResolver(EntityResolver er) {
  -        this.parser.setEntityResolver(er);
  +    public void setEntityResolver(org.xml.sax.EntityResolver er) {
  +        this.er = er;
       }
   
  -    /**
  -     * Specifies the <code>ErrorHandler</code> to be used by this
  -     * <code>DocumentBuilderImpl</code>.
  -     */
  -    public void setErrorHandler(ErrorHandler eh) {
  -        this.parser.setErrorHandler(eh);
  +    public void setErrorHandler(org.xml.sax.ErrorHandler eh) {
  +        this.eh = eh; 
       }
   }
  -
  
  
  
  1.1.4.2   +17 -22    xml-xerces/java/src/org/apache/xerces/jaxp/DocumentBuilderFactoryImpl.java
  
  Index: DocumentBuilderFactoryImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/jaxp/DocumentBuilderFactoryImpl.java,v
  retrieving revision 1.1.4.1
  retrieving revision 1.1.4.2
  diff -u -r1.1.4.1 -r1.1.4.2
  --- DocumentBuilderFactoryImpl.java	2000/12/12 19:07:48	1.1.4.1
  +++ DocumentBuilderFactoryImpl.java	2001/02/02 23:06:56	1.1.4.2
  @@ -1,4 +1,6 @@
   /*
  + * $Id: DocumentBuilderFactoryImpl.java,v 1.1.4.2 2001/02/02 23:06:56 edwingo Exp $
  + *
    * The Apache Software License, Version 1.1
    *
    *
  @@ -49,43 +51,36 @@
    *
    * This software consists of voluntary contributions made by many
    * individuals on behalf of the Apache Software Foundation and was
  - * originally based on software copyright (c) 1999-2000, Pierpaolo
  - * Fumagalli <mailto:pier@betaversion.org>, http://www.apache.org.
  - * For more information on the Apache Software Foundation, please see
  - * <http://www.apache.org/>.
  + * originally based on software copyright (c) 1999, Sun Microsystems, Inc., 
  + * http://www.sun.com.  For more information on the Apache Software 
  + * Foundation, please see <http://www.apache.org/>.
    */
   
  +
   package org.apache.xerces.jaxp;
   
  -import javax.xml.parsers.ParserConfigurationException;
  -import javax.xml.parsers.DocumentBuilder;
   import javax.xml.parsers.DocumentBuilderFactory;
  -import org.xml.sax.SAXException;
  +import javax.xml.parsers.DocumentBuilder;
  +import javax.xml.parsers.ParserConfigurationException;
   
   /**
  - * The <code>DocumentBuilderFactory</code> implementation for the Apache
  - * Xerces XML parser.
  - *
  - * @author <a href="mailto:fumagalli@exoffice.com">Pierpaolo Fumagalli</a>
  - *         (Apache Software Foundation, Exoffice Technologies)
  - * @version $Revision: 1.1.4.1 $ $Date: 2000/12/12 19:07:48 $
  + * @author Rajiv Mordani
  + * @version $Revision: 1.1.4.2 $
    */
  -public class DocumentBuilderFactoryImpl extends DocumentBuilderFactory{
  +public class DocumentBuilderFactoryImpl extends DocumentBuilderFactory {
   
  -    /**
  -     * Create a new <code>DocumentBuilderFactoryImpl</code> instance.
  -     */
       public DocumentBuilderFactoryImpl() {
  -        super();
  +   	 
       }
   
       /**
  -     * Returns a new configured instance of type <code>DocumentBuilder</code>.
  +     * 
        */
       public DocumentBuilder newDocumentBuilder()
  -    throws ParserConfigurationException {
  -        return(new DocumentBuilderImpl(this.isNamespaceAware(),
  -                                       this.isValidating()));
  +        throws ParserConfigurationException 
  +    {
  +	DocumentBuilderImpl db = new DocumentBuilderImpl(this);
  +        return db;
       }
   
       /**
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.1   +91 -0     xml-xerces/java/src/org/apache/xerces/jaxp/Attic/DefaultValidationErrorHandler.java
  
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.4.2.2   +3 -3      xml-xerces/java/src/javax/xml/parsers/DocumentBuilderFactory.java
  
  Index: DocumentBuilderFactory.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/javax/xml/parsers/DocumentBuilderFactory.java,v
  retrieving revision 1.4.2.1
  retrieving revision 1.4.2.2
  diff -u -r1.4.2.1 -r1.4.2.2
  --- DocumentBuilderFactory.java	2000/12/12 19:07:31	1.4.2.1
  +++ DocumentBuilderFactory.java	2001/02/02 23:07:06	1.4.2.2
  @@ -97,7 +97,7 @@
    *
    * @author <a href="pier@betaversion.org">Pierpaolo Fumagalli</a>
    * @author Copyright &copy; 2000 The Apache Software Foundation.
  - * @version 1.0 CVS $Revision: 1.4.2.1 $ $Date: 2000/12/12 19:07:31 $
  + * @version 1.0 CVS $Revision: 1.4.2.2 $ $Date: 2001/02/02 23:07:06 $
    */
   public abstract class DocumentBuilderFactory {
       /** The default property name according to the JAXP spec */
  @@ -196,7 +196,7 @@
        * they are parsed.
        */
       
  -    public void setIgnoreElementContentWhitespace(boolean whitespace) {
  +    public void setIgnoringElementContentWhitespace(boolean whitespace) {
           this.whitespace = whitespace;
       }
   
  @@ -252,7 +252,7 @@
        * content during parse.
        */
       
  -    public boolean isIgnoreElementContentWhitespace() {
  +    public boolean isIgnoringElementContentWhitespace() {
           return whitespace;
       }
   
  
  
  
  1.2.2.2   +8 -1      xml-xerces/java/src/javax/xml/parsers/DocumentBuilder.java
  
  Index: DocumentBuilder.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/javax/xml/parsers/DocumentBuilder.java,v
  retrieving revision 1.2.2.1
  retrieving revision 1.2.2.2
  diff -u -r1.2.2.1 -r1.2.2.2
  --- DocumentBuilder.java	2000/12/12 19:07:31	1.2.2.1
  +++ DocumentBuilder.java	2001/02/02 23:07:07	1.2.2.2
  @@ -65,6 +65,7 @@
   import org.xml.sax.InputSource;
   import org.xml.sax.SAXException;
   import org.w3c.dom.Document;
  +import org.w3c.dom.DOMImplementation;
   
   /**
    * Instances of <code>DocumentBuilder</code> provide a mechansim for
  @@ -108,7 +109,7 @@
    *
    * @author <a href="pier@betaversion.org">Pierpaolo Fumagalli</a>
    * @author Copyright &copy; 2000 The Apache Software Foundation.
  - * @version 1.0 CVS $Revision: 1.2.2.1 $ $Date: 2000/12/12 19:07:31 $
  + * @version 1.0 CVS $Revision: 1.2.2.2 $ $Date: 2001/02/02 23:07:07 $
    */
   public abstract class DocumentBuilder {
   
  @@ -273,4 +274,10 @@
       
       public abstract Document newDocument();
   
  +    /**
  +     * Obtain an instance of a {@link org.w3c.dom.DOMImplementation} object.
  +     *
  +     * @return A new instance of a <code>DOMImplementation</code>.
  +     */
  +    public abstract DOMImplementation getDOMImplementation();
   }
  
  
  

Mime
View raw message