sylvain     01/12/21 07:20:19

  Modified:    .        changes.xml
               src/org/apache/cocoon/components/language/markup
                        AbstractMarkupLanguage.java
               src/org/apache/cocoon/components/parser JaxpParser.java
                        PooledJaxpParser.java XercesParser.java
               src/org/apache/cocoon/components/xslt XSLTProcessorImpl.java
  Log:
  - don't set namespace-prefixes by default,
  - moved PooledJaxpParser to JaxpParser and deprecated it.
  
  Revision  Changes    Path
  1.63      +5 -1      xml-cocoon2/changes.xml
  
  Index: changes.xml
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/changes.xml,v
  retrieving revision 1.62
  retrieving revision 1.63
  diff -u -r1.62 -r1.63
  --- changes.xml       2001/12/21 03:29:56     1.62
  +++ changes.xml       2001/12/21 15:20:19     1.63
  @@ -4,7 +4,7 @@
   
   <!--
     History of Cocoon changes
  -  $Id: changes.xml,v 1.62 2001/12/21 03:29:56 vgritsenko Exp $
  +  $Id: changes.xml,v 1.63 2001/12/21 15:20:19 sylvain Exp $
   -->
   
   <changes title="History of Changes">
  @@ -29,6 +29,10 @@
    </devs>
   
    <release version="@version@" date="@date@">
  +  <action dev="SW" type="update">
  +    The "namespace-prefixes" feature is no more set on parsers. It can be set if
  +    needed in the configuration.
  +  </action>
     <action dev="VG" type="add">
       Added ability to use XPath expressions to query XML:DB collections using
       XML:DB pseudo protocol. URL should be in form:
  
  
  
  1.14      +1 -2      
xml-cocoon2/src/org/apache/cocoon/components/language/markup/AbstractMarkupLanguage.java
  
  Index: AbstractMarkupLanguage.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/org/apache/cocoon/components/language/markup/AbstractMarkupLanguage.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- AbstractMarkupLanguage.java       2001/10/11 07:20:25     1.13
  +++ AbstractMarkupLanguage.java       2001/12/21 15:20:19     1.14
  @@ -38,7 +38,7 @@
    * @author <a href="mailto:[EMAIL PROTECTED]";>Ricardo Rocha</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Davanum Srinivas</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Ovidiu Predescu</a>
  - * @version CVS $Revision: 1.13 $ $Date: 2001/10/11 07:20:25 $
  + * @version CVS $Revision: 1.14 $ $Date: 2001/12/21 15:20:19 $
    */
   public abstract class AbstractMarkupLanguage extends AbstractLoggable
     implements MarkupLanguage, Composable, Configurable
  @@ -260,7 +260,6 @@
               }
               // Create a XMLReader
               XMLReader reader = XMLReaderFactory.createXMLReader();
  -            reader.setFeature("http://xml.org/sax/features/namespace-prefixes";, 
true);
               // Get the needed preprocess filter
               XMLFilter preprocessFilter = this.getPreprocessFilter(filename, 
programmingLanguage);
               preprocessFilter.setParent(reader);
  
  
  
  1.14      +151 -66   
xml-cocoon2/src/org/apache/cocoon/components/parser/JaxpParser.java
  
  Index: JaxpParser.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/org/apache/cocoon/components/parser/JaxpParser.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- JaxpParser.java   2001/11/06 11:27:12     1.13
  +++ JaxpParser.java   2001/12/21 15:20:19     1.14
  @@ -7,7 +7,7 @@
    *****************************************************************************/
   package org.apache.cocoon.components.parser;
   
  -import org.apache.avalon.excalibur.pool.Recyclable;
  +import org.apache.avalon.excalibur.pool.Poolable;
   import org.apache.avalon.framework.component.ComponentException;
   import org.apache.avalon.framework.component.ComponentManager;
   import org.apache.avalon.framework.component.Composable;
  @@ -27,26 +27,68 @@
   
   /**
    * An XMLParser that is only dependant on JAXP 1.1 compliant parsers.
  - * If only we can get rid of the need for the Document...
    *
  + * The configuration can contain the following parameters :
  + * <ul>
  + * <li>validate (boolean, default = <code>false</code>) : should the parser
  + *     validate parsed documents ?
  + * </li>
  + * <li>namespace-prefixes (boolean, default = <code>false</code>) : do we want
  + *     namespaces declarations also as 'xmlns:' attributes ?<br>
  + *     <i>Note</i> : setting this to <code>true</code> confuses some XSL
  + *     processors (e.g. Saxon).
  + * </li>
  + * <li>reuse-parsers (boolean, default = <code>true</code>) : do we want to reuse
  + *     parsers or create a new parser for each parse ?<br>
  + *     <i>Note</i> : even if this parameter is <code>true</code>, parsers are not
  + *     recycled in case of parsing errors : some parsers (e.g. Xerces) don't like
  + *     to be reused after failure.
  + * </li>
  + * <li>sax-parser-factory (string, optional) : the name of the 
<code>SAXParserFactory</code>
  + *     implementation class to be used instead of using the standard JAXP mechanism
  + *     (<code>SAXParserFactory.newInstance()</code>). This allows to choose
  + *     unambiguously the JAXP implementation to be used when several of them are
  + *     available in the classpath.
  + * </li>
  + * <li>document-builder-factory (string, optional) : the name of the
  + *     <code>DocumentBuilderFactory</code> implementation to be used (similar to
  + *     <code>sax-parser-factory</code> for DOM).
  + * </li>
  + * </ul>
  + *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Berin Loritsch</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Carsten Ziegeler</a>
  - * @version CVS $Revision: 1.13 $ $Date: 2001/11/06 11:27:12 $
  + * @author <a href="mailto:[EMAIL PROTECTED]";>Sylvain Wallez</a>
  + * @version CVS $Revision: 1.14 $ $Date: 2001/12/21 15:20:19 $
    */
   public class JaxpParser extends AbstractXMLProducer
  -implements Parser, ErrorHandler, Composable, Configurable, Recyclable {
  +implements Parser, ErrorHandler, Composable, Configurable, Poolable {
   
       /** the SAX Parser factory */
       protected SAXParserFactory factory;
   
       /** the Document Builder factory */
  -    protected DocumentBuilderFactory docfactory;
  +    protected DocumentBuilderFactory docFactory;
   
  +    /** The SAX reader. It is created lazily by {@link #setupXMLReader()}
  +        and cleared if a parsing error occurs. */
  +    protected XMLReader reader;
  +    
  +    /** The DOM builder. It is created lazily by {@link #setupDocumentBuilder()}
  +        and cleared if a parsing error occurs. */
  +    protected DocumentBuilder docBuilder;
  +    
       /** the component manager */
       protected ComponentManager manager;
   
       /** the Entity Resolver */
       protected Resolver resolver;
  +    
  +    /** do we want namespaces also as attributes ? */
  +    protected boolean nsPrefixes;
  +    
  +    /** do we want to reuse parsers ? */
  +    protected boolean reuseParsers;
   
       /**
        * Get the Entity Resolver from the component manager
  @@ -69,66 +111,82 @@
       public void configure(Configuration config)
       throws ConfigurationException {
           Parameters params = Parameters.fromConfiguration(config);
  +        
  +        // Validation and namespace prefixes parameters
           boolean validate = params.getParameterAsBoolean("validate", false);
  -        this.factory = SAXParserFactory.newInstance();
  -        this.docfactory = DocumentBuilderFactory.newInstance();
  -        this.factory.setNamespaceAware(true);
  -        this.factory.setValidating(validate);
  -        this.docfactory.setNamespaceAware(true);
  -        this.docfactory.setValidating(validate);
  -        getLogger().debug("SAXParserFactory: " + 
ClassUtils.which(this.factory.getClass()));
  -        getLogger().debug("DocumentBuilderFactory: " + 
ClassUtils.which(this.docfactory.getClass()));
  -        try {
  -            SAXParser parser = this.factory.newSAXParser();
  -            getLogger().debug("SAXParser: " + ClassUtils.which(parser.getClass()));
  -        } catch (Exception e) {
  -            getLogger().error("Cannot produce a valid parser", e);
  -            // we ignore it here for now
  +        this.nsPrefixes = params.getParameterAsBoolean("namespace-prefixes", false);
  +        this.reuseParsers = params.getParameterAsBoolean("reuse-parsers", true);
  +        
  +        // Get the SAXFactory
  +        String className = params.getParameter("sax-parser-factory", null);
  +        if (className == null) {
  +            factory = SAXParserFactory.newInstance();
  +        } else {
  +            // Will use specific class
  +            try {
  +                Class factoryClass = ClassUtils.loadClass(className);
  +                factory = (SAXParserFactory)factoryClass.newInstance();
  +            } catch(Exception e) {
  +                throw new ConfigurationException("Cannot load SAXParserFactory 
class " + className, e);
  +            }
  +        }
  +        getLogger().debug("SAXParserFactory: " + 
ClassUtils.which(factory.getClass()));
  +        factory.setNamespaceAware(true);
  +        factory.setValidating(validate);
  +        
  +        
  +        // Get the DocumentFactory
  +        className = params.getParameter("document-builder-factory", null);
  +        if (className == null) {
  +            this.docFactory = DocumentBuilderFactory.newInstance();
  +        } else {
  +            // Will use specific class
  +            try {
  +                Class factoryClass = ClassUtils.loadClass(className);
  +                this.docFactory = 
(DocumentBuilderFactory)factoryClass.newInstance();
  +            } catch(Exception e) {
  +                throw new ConfigurationException("Cannot load 
DocumentBuilderFactory class " + className, e);
  +            }
           }
  +        getLogger().debug("DocumentBuilderFactory: " + 
ClassUtils.which(docFactory.getClass()));
  +
  +        docFactory.setNamespaceAware(true);
  +        docFactory.setValidating(validate);
       }
   
       public void parse(InputSource in)
       throws SAXException, IOException {
  -        SAXParser parser = null;
  -
  -        try {
  -            parser = this.factory.newSAXParser();
  -        } catch (ParserConfigurationException e) {
  -            getLogger().error("Cannot produce a valid parser", e);
  -            throw new SAXException("Could not get valid parser" + e.getMessage(), 
e);
  -        }
  -
  -        XMLReader reader = parser.getXMLReader();
  -
  -        reader.setFeature("http://xml.org/sax/features/namespace-prefixes";, true);
  +        setupXMLReader();
           try {
  -            reader.setProperty("http://xml.org/sax/properties/lexical-handler";,
  -                        super.lexicalHandler);
  +            
this.reader.setProperty("http://xml.org/sax/properties/lexical-handler";, 
super.lexicalHandler);
           } catch (SAXException e) {
               getLogger().warn("SAX2 driver does not support property: "+
                                "'http://xml.org/sax/properties/lexical-handler'");
           }
   
  -        reader.setErrorHandler(this);
  -        reader.setContentHandler(super.contentHandler);
  -        if(this.resolver != null)
  +        this.reader.setErrorHandler(this);
  +        this.reader.setContentHandler(super.contentHandler);
  +        if(this.resolver != null) {
               reader.setEntityResolver(this.resolver);
  -        reader.parse(in);
  +        }
  +        
  +        // Ensure we will use a fresh new parser at next parse in case of failure
  +        XMLReader tmpReader = this.reader;
  +        this.reader = null;
  +
  +        tmpReader.parse(in);
  +        
  +        // Here, parsing was successful : restore this.reader
  +        if (this.reuseParsers)
  +            this.reader = tmpReader;
       }
   
       /**
        * Create a new Document object.
        */
       public Document newDocument() {
  -        DocumentBuilder builder = null;
  -
  -        try {
  -            builder = this.docfactory.newDocumentBuilder();
  -        } catch (ParserConfigurationException pce) {
  -            getLogger().error("Could not create DocumentBuilder", pce);
  -            return null;
  -        }
  -        return builder.newDocument();
  +        setupDocumentBuilder();
  +        return this.docBuilder.newDocument();
       }
   
       /**
  @@ -143,37 +201,64 @@
        * system ID.
        */
       public Document newDocument(String name, String publicId, String systemId) {
  -        DocumentBuilder builder = null;
  -
  -        try {
  -            builder = this.docfactory.newDocumentBuilder();
  -        } catch (ParserConfigurationException pce) {
  -            getLogger().error("Could not build DocumentBuilder", pce);
  -            return null;
  -        }
  -
  +        setupDocumentBuilder();
           // Fixme: is there a better way to achieve this?
  -        DOMImplementation impl = builder.newDocument().getImplementation();
  +        DOMImplementation impl = this.docBuilder.newDocument().getImplementation();
           return impl.createDocument(
               null,
               name,
               impl.createDocumentType(name, publicId, systemId)
           );
  -
       }
  -
  +    
       /**
        * Parses a new Document object from the given InputSource.
        */
       public Document parseDocument(InputSource input) throws SAXException, 
IOException {
  -      DocumentBuilder builder = null;
  -      try {
  -        builder = this.docfactory.newDocumentBuilder();
  -      } catch (ParserConfigurationException pce) {
  -        getLogger().error("Could not build DocumentBuilder", pce);
  -        return null;
  -      }
  -      return builder.parse(input);
  +        setupDocumentBuilder();
  +
  +        // Ensure we will use a fresh new parser at next parse in case of failure
  +        DocumentBuilder tmpBuilder = this.docBuilder;
  +        this.docBuilder = null;
  +
  +        Document result = tmpBuilder.parse(input);
  +        
  +        // Here, parsing was successful : restore this.builder
  +        if (this.reuseParsers)
  +            this.docBuilder = tmpBuilder;
  +        
  +        return result;
  +    }
  +    
  +    /**
  +     * Creates a new <code>XMLReader</code> if needed.
  +     */
  +    protected void setupXMLReader() throws SAXException {
  +        if (this.reader == null) {
  +            // Create the XMLReader
  +            try {
  +                this.reader = factory.newSAXParser().getXMLReader();
  +                
this.reader.setFeature("http://xml.org/sax/features/namespace-prefixes";, nsPrefixes);
  +            } catch(Exception e) {
  +                getLogger().error("Cannot produce a valid parser", e);
  +                throw new SAXException("Cannot produce a valid parser", e);
  +            }
  +        }
  +    }
  +    
  +    /**
  +     * Creates a new <code>DocumentBuilder</code> if needed.
  +     */
  +    protected void setupDocumentBuilder() {
  +        if (this.docBuilder == null) {
  +            try {
  +                this.docBuilder = this.docFactory.newDocumentBuilder();
  +            } catch (ParserConfigurationException pce) {
  +                getLogger().error("Could not create DocumentBuilder", pce);
  +                throw new org.apache.avalon.framework.CascadingRuntimeException(
  +                    "Could not create DocumentBuilder", pce);
  +            }
  +        }
       }
   
       /**
  
  
  
  1.3       +5 -277    
xml-cocoon2/src/org/apache/cocoon/components/parser/PooledJaxpParser.java
  
  Index: PooledJaxpParser.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/org/apache/cocoon/components/parser/PooledJaxpParser.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- PooledJaxpParser.java     2001/11/13 13:43:07     1.2
  +++ PooledJaxpParser.java     2001/12/21 15:20:19     1.3
  @@ -7,287 +7,15 @@
    *****************************************************************************/
   package org.apache.cocoon.components.parser;
   
  -import org.apache.avalon.excalibur.pool.Poolable;
  -import org.apache.avalon.framework.component.ComponentException;
  -import org.apache.avalon.framework.component.ComponentManager;
  -import org.apache.avalon.framework.component.Composable;
  -import org.apache.avalon.framework.configuration.Configurable;
  -import org.apache.avalon.framework.configuration.Configuration;
  -import org.apache.avalon.framework.configuration.ConfigurationException;
  -import org.apache.avalon.framework.parameters.Parameters;
  -import org.apache.cocoon.components.resolver.Resolver;
  -import org.apache.cocoon.util.ClassUtils;
  -import org.apache.cocoon.xml.AbstractXMLProducer;
  -import org.w3c.dom.DOMImplementation;
  -import org.w3c.dom.Document;
  -import org.xml.sax.*;
   
  -import javax.xml.parsers.*;
  -import java.io.IOException;
  -
   /**
  - * An XMLParser that is only dependant on JAXP 1.1 compliant parsers.
  - *
  - * The configuration can contain the following parameters :
  - * <ul>
  - * <li>validate (boolean, default = <code>false</code>) : should the parser
  - *     validate parsed documents ?
  - * </li>
  - * <li>namespace-prefixes (boolean, default = <code>true</code>) : do we want
  - *     namespaces declarations also as 'xmlns:' attributes ? The Cocoon default
  - *     up to now was <code>true</code>, but this confuses some XSL processors
  - *     (e.g. Saxon).
  - * </li>
  - * <li>reuse-parsers (boolean, default = <code>true</code>) : do we want to reuse
  - *     parsers or create a new parser for each parse ?<br>
  - *     <i>Note</i> : even if this parameter is <code>true</code>, parsers are not
  - *     recycled in case of parsing errors : some parsers (e.g. Xerces) don't like
  - *     to be reused after failure.
  - * </li>
  - * <li>sax-parser-factory (string, optional) : the name of the 
<code>SAXParserFactory</code>
  - *     implementation class to be used instead of using the standard JAXP mechanism
  - *     (<code>SAXParserFactory.newInstance()</code>). This allows to choose
  - *     unambiguously the JAXP implementation to be used when several of them are
  - *     available in the classpath.
  - * </li>
  - * <li>document-builder-factory (string, optional) : the name of the
  - *     <code>DocumentBuilderFactory</code> implementation to be used (similar to
  - *     <code>sax-parser-factory</code> for DOM).
  - * </li>
  - * </ul>
  + * @deprecated <code>PooledJaxpParser</code> is now the default parser for Cocoon
  + *             and has thus been moved to {@link JaxpParser} - this class will be
  + *             removed in a future release.
    *
  - * @author <a href="mailto:[EMAIL PROTECTED]";>Berin Loritsch</a>
  - * @author <a href="mailto:[EMAIL PROTECTED]";>Carsten Ziegeler</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Sylvain Wallez</a>
  - * @version CVS $Revision: 1.2 $ $Date: 2001/11/13 13:43:07 $
  + * @version CVS $Revision: 1.3 $ $Date: 2001/12/21 15:20:19 $
    */
  -public class PooledJaxpParser extends AbstractXMLProducer
  -implements Parser, ErrorHandler, Composable, Configurable, Poolable {
  -
  -    /** the SAX Parser factory */
  -    protected SAXParserFactory factory;
  -
  -    /** the Document Builder factory */
  -    protected DocumentBuilderFactory docFactory;
  -
  -    /** The SAX reader. It is created lazily by {@link #setupXMLReader()}
  -        and cleared if a parsing error occurs. */
  -    protected XMLReader reader;
  -    
  -    /** The DOM builder. It is created lazily by {@link #setupDocumentBuilder()}
  -        and cleared if a parsing error occurs. */
  -    protected DocumentBuilder docBuilder;
  -    
  -    /** the component manager */
  -    protected ComponentManager manager;
  -
  -    /** the Entity Resolver */
  -    protected Resolver resolver;
  -    
  -    /** do we want namespaces also as attributes ? */
  -    protected boolean nsPrefixes;
  -    
  -    /** do we want to reuse parsers ? */
  -    protected boolean reuseParsers;
  -
  -    /**
  -     * Get the Entity Resolver from the component manager
  -     */
  -    public void compose(ComponentManager manager)
  -    throws ComponentException {
  -        try {
  -            this.manager = manager;
  -            getLogger().debug("Looking up " + Resolver.ROLE);
  -            this.resolver = (Resolver)manager.lookup(Resolver.ROLE);
  -        } catch(ComponentException e) {
  -            // This exception is ok during initialization/startup.
  -            getLogger().debug("JaxpParser: Could not yet find " + Resolver.ROLE);
  -        }
  -    }
  -
  -    /**
  -     * Configure
  -     */
  -    public void configure(Configuration config)
  -    throws ConfigurationException {
  -        Parameters params = Parameters.fromConfiguration(config);
  -        
  -        // Validation and namespace prefixes parameters
  -        boolean validate = params.getParameterAsBoolean("validate", false);
  -        this.nsPrefixes = params.getParameterAsBoolean("namespace-prefixes", true);
  -        this.reuseParsers = params.getParameterAsBoolean("reuse-parsers", true);
  -        
  -        // Get the SAXFactory
  -        String className = params.getParameter("sax-parser-factory", null);
  -        if (className == null) {
  -            factory = SAXParserFactory.newInstance();
  -        } else {
  -            // Will use specific class
  -            try {
  -                Class factoryClass = ClassUtils.loadClass(className);
  -                factory = (SAXParserFactory)factoryClass.newInstance();
  -            } catch(Exception e) {
  -                throw new ConfigurationException("Cannot load SAXParserFactory 
class " + className, e);
  -            }
  -        }
  -        getLogger().debug("SAXParserFactory: " + 
ClassUtils.which(factory.getClass()));
  -        factory.setNamespaceAware(true);
  -        factory.setValidating(validate);
  -        
  -        
  -        // Get the DocumentFactory
  -        className = params.getParameter("document-builder-factory", null);
  -        if (className == null) {
  -            this.docFactory = DocumentBuilderFactory.newInstance();
  -        } else {
  -            // Will use specific class
  -            try {
  -                Class factoryClass = ClassUtils.loadClass(className);
  -                this.docFactory = 
(DocumentBuilderFactory)factoryClass.newInstance();
  -            } catch(Exception e) {
  -                throw new ConfigurationException("Cannot load 
DocumentBuilderFactory class " + className, e);
  -            }
  -        }
  -        getLogger().debug("DocumentBuilderFactory: " + 
ClassUtils.which(docFactory.getClass()));
  -
  -        docFactory.setNamespaceAware(true);
  -        docFactory.setValidating(validate);
  -    }
  -
  -    public void parse(InputSource in)
  -    throws SAXException, IOException {
  -        setupXMLReader();
  -        try {
  -            
this.reader.setProperty("http://xml.org/sax/properties/lexical-handler";, 
super.lexicalHandler);
  -        } catch (SAXException e) {
  -            getLogger().warn("SAX2 driver does not support property: "+
  -                             "'http://xml.org/sax/properties/lexical-handler'");
  -        }
  -
  -        this.reader.setErrorHandler(this);
  -        this.reader.setContentHandler(super.contentHandler);
  -        if(this.resolver != null) {
  -            reader.setEntityResolver(this.resolver);
  -        }
  -        
  -        // Ensure we will use a fresh new parser at next parse in case of failure
  -        XMLReader tmpReader = this.reader;
  -        this.reader = null;
  -
  -        tmpReader.parse(in);
  -        
  -        // Here, parsing was successful : restore this.reader
  -        if (this.reuseParsers)
  -            this.reader = tmpReader;
  -    }
  -
  -    /**
  -     * Create a new Document object.
  -     */
  -    public Document newDocument() {
  -        setupDocumentBuilder();
  -        return this.docBuilder.newDocument();
  -    }
  -
  -    /**
  -     * Create a new Document object with a specified DOCTYPE.
  -     */
  -    public Document newDocument(String name) {
  -        return this.newDocument(name, null, null);
  -    }
  -
  -    /**
  -     * Create a new Document object with a specified DOCTYPE, public ID and
  -     * system ID.
  -     */
  -    public Document newDocument(String name, String publicId, String systemId) {
  -        setupDocumentBuilder();
  -        // Fixme: is there a better way to achieve this?
  -        DOMImplementation impl = this.docBuilder.newDocument().getImplementation();
  -        return impl.createDocument(
  -            null,
  -            name,
  -            impl.createDocumentType(name, publicId, systemId)
  -        );
  -    }
  -    
  -    /**
  -     * Parses a new Document object from the given InputSource.
  -     */
  -    public Document parseDocument(InputSource input) throws SAXException, 
IOException {
  -        setupDocumentBuilder();
  -
  -        // Ensure we will use a fresh new parser at next parse in case of failure
  -        DocumentBuilder tmpBuilder = this.docBuilder;
  -        this.docBuilder = null;
  -
  -        Document result = tmpBuilder.parse(input);
  -        
  -        // Here, parsing was successful : restore this.builder
  -        if (this.reuseParsers)
  -            this.docBuilder = tmpBuilder;
  -        
  -        return result;
  -    }
  -    
  -    /**
  -     * Creates a new <code>XMLReader</code> if needed.
  -     */
  -    protected void setupXMLReader() throws SAXException {
  -        if (this.reader == null) {
  -            // Create the XMLReader
  -            try {
  -                this.reader = factory.newSAXParser().getXMLReader();
  -                
this.reader.setFeature("http://xml.org/sax/features/namespace-prefixes";, nsPrefixes);
  -            } catch(Exception e) {
  -                getLogger().error("Cannot produce a valid parser", e);
  -                throw new SAXException("Cannot produce a valid parser", e);
  -            }
  -        }
  -    }
  -    
  -    /**
  -     * Creates a new <code>DocumentBuilder</code> if needed.
  -     */
  -    protected void setupDocumentBuilder() {
  -        if (this.docBuilder == null) {
  -            try {
  -                this.docBuilder = this.docFactory.newDocumentBuilder();
  -            } catch (ParserConfigurationException pce) {
  -                getLogger().error("Could not create DocumentBuilder", pce);
  -                throw new org.apache.avalon.framework.CascadingRuntimeException(
  -                    "Could not create DocumentBuilder", pce);
  -            }
  -        }
  -    }
  -
  -    /**
  -     * Receive notification of a recoverable error.
  -     */
  -    public void error(SAXParseException e)
  -    throws SAXException {
  -        throw new SAXException("Error parsing "+e.getSystemId()+" (line "+
  -                               e.getLineNumber()+" col. "+e.getColumnNumber()+
  -                               "): "+e.getMessage(),e);
  -    }
  -
  -    /**
  -     * Receive notification of a fatal error.
  -     */
  -    public void fatalError(SAXParseException e)
  -    throws SAXException {
  -        throw new SAXException("Fatal error parsing "+e.getSystemId()+" (line "+
  -                               e.getLineNumber()+" col. "+e.getColumnNumber()+
  -                               "): "+e.getMessage(),e);
  -    }
  +public class PooledJaxpParser extends JaxpParser {
   
  -    /**
  -     * Receive notification of a warning.
  -     */
  -    public void warning(SAXParseException e)
  -    throws SAXException {
  -        throw new SAXException("Warning parsing "+e.getSystemId()+" (line "+
  -                               e.getLineNumber()+" col. "+e.getColumnNumber()+
  -                               "): "+e.getMessage(),e);
  -    }
   }
  
  
  
  1.7       +1 -5      
xml-cocoon2/src/org/apache/cocoon/components/parser/XercesParser.java
  
  Index: XercesParser.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/org/apache/cocoon/components/parser/XercesParser.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- XercesParser.java 2001/11/06 11:27:13     1.6
  +++ XercesParser.java 2001/12/21 15:20:19     1.7
  @@ -29,7 +29,7 @@
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Pierpaolo Fumagalli</a>
    *         (Apache Software Foundation, Exoffice Technologies)
  - * @version CVS $Revision: 1.6 $ $Date: 2001/11/06 11:27:13 $
  + * @version CVS $Revision: 1.7 $ $Date: 2001/12/21 15:20:19 $
    */
   public class XercesParser extends AbstractXMLProducer
   implements Parser, ErrorHandler, Composable, SingleThreaded {
  @@ -49,8 +49,6 @@
   
           this.parser.setFeature("http://xml.org/sax/features/validation",false);
           this.parser.setFeature("http://xml.org/sax/features/namespaces",true);
  -        this.parser.setFeature("http://xml.org/sax/features/namespace-prefixes";,
  -                          true);
       }
   
       /**
  @@ -119,8 +117,6 @@
   
               parser.setFeature("http://xml.org/sax/features/validation",false);
               parser.setFeature("http://xml.org/sax/features/namespaces",true);
  -            parser.setFeature("http://xml.org/sax/features/namespace-prefixes";,
  -                              true);
   
               parser.parse(input);
           } catch (Exception pce) {
  
  
  
  1.16      +0 -2      
xml-cocoon2/src/org/apache/cocoon/components/xslt/XSLTProcessorImpl.java
  
  Index: XSLTProcessorImpl.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/org/apache/cocoon/components/xslt/XSLTProcessorImpl.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- XSLTProcessorImpl.java    2001/12/14 03:13:05     1.15
  +++ XSLTProcessorImpl.java    2001/12/21 15:20:19     1.16
  @@ -177,8 +177,6 @@
   
           // Create an XMLReader and set its ContentHandler.
           XMLReader reader = XMLReaderFactory.createXMLReader();
  -        reader.setFeature("http://xml.org/sax/features/namespace-prefixes";,
  -                          true);
   
           if (filter != null) {
             filter.setParent(reader);
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     [EMAIL PROTECTED]
To unsubscribe, e-mail:          [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to