org.apache.avalon.excalibur.xml
Class JaxpParser

java.lang.Object
  |
  +--org.apache.avalon.framework.logger.AbstractLogEnabled
        |
        +--org.apache.avalon.excalibur.xml.JaxpParser
All Implemented Interfaces:
org.apache.avalon.framework.component.Component, org.apache.avalon.framework.component.Composable, org.xml.sax.ErrorHandler, org.apache.avalon.framework.logger.LogEnabled, org.apache.avalon.framework.parameters.Parameterizable, Parser, Poolable

public class JaxpParser
extends org.apache.avalon.framework.logger.AbstractLogEnabled
implements Parser, org.xml.sax.ErrorHandler, org.apache.avalon.framework.component.Composable, org.apache.avalon.framework.parameters.Parameterizable, Poolable

An XMLParser that is only dependant on JAXP 1.1 compliant parsers. The configuration can contain the following parameters :

Version:
CVS $Revision: 1.9 $ $Date: 2002/01/03 07:18:28 $
Author:
Berin Loritsch, Carsten Ziegeler, Sylvain Wallez

Field Summary
protected  javax.xml.parsers.DocumentBuilder docBuilder
          The DOM builder.
protected  javax.xml.parsers.DocumentBuilderFactory docFactory
          the Document Builder factory
protected  javax.xml.parsers.SAXParserFactory factory
          the SAX Parser factory
protected  org.apache.avalon.framework.component.ComponentManager manager
          the component manager
protected  boolean nsPrefixes
          do we want namespaces also as attributes ?
protected  org.xml.sax.XMLReader reader
          The SAX reader.
protected  EntityResolver resolver
          the Entity Resolver
protected  boolean reuseParsers
          do we want to reuse parsers ?
protected  boolean stopOnRecoverableError
          do we stop on recoverable errors ?
protected  boolean stopOnWarning
          do we stop on warnings ?
 
Fields inherited from interface org.apache.avalon.excalibur.xml.Parser
ROLE
 
Constructor Summary
JaxpParser()
           
 
Method Summary
 void compose(org.apache.avalon.framework.component.ComponentManager manager)
          Get the Entity Resolver from the component manager
 void error(org.xml.sax.SAXParseException e)
          Receive notification of a recoverable error.
 void fatalError(org.xml.sax.SAXParseException e)
          Receive notification of a fatal error.
 void parameterize(org.apache.avalon.framework.parameters.Parameters params)
          Configure
 void parse(org.xml.sax.InputSource in, org.xml.sax.ContentHandler consumer)
          Parse the InputSource and send SAX events to the consumer.
 org.w3c.dom.Document parseDocument(org.xml.sax.InputSource input)
          Parses a new Document object from the given InputSource.
protected  void setupDocumentBuilder()
          Creates a new DocumentBuilder if needed.
protected  void setupXMLReader()
          Creates a new XMLReader if needed.
 void warning(org.xml.sax.SAXParseException e)
          Receive notification of a warning.
 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

factory

protected javax.xml.parsers.SAXParserFactory factory
the SAX Parser factory

docFactory

protected javax.xml.parsers.DocumentBuilderFactory docFactory
the Document Builder factory

reader

protected org.xml.sax.XMLReader reader
The SAX reader. It is created lazily by setupXMLReader() and cleared if a parsing error occurs.

docBuilder

protected javax.xml.parsers.DocumentBuilder docBuilder
The DOM builder. It is created lazily by setupDocumentBuilder() and cleared if a parsing error occurs.

manager

protected org.apache.avalon.framework.component.ComponentManager manager
the component manager

resolver

protected EntityResolver resolver
the Entity Resolver

nsPrefixes

protected boolean nsPrefixes
do we want namespaces also as attributes ?

reuseParsers

protected boolean reuseParsers
do we want to reuse parsers ?

stopOnWarning

protected boolean stopOnWarning
do we stop on warnings ?

stopOnRecoverableError

protected boolean stopOnRecoverableError
do we stop on recoverable errors ?
Constructor Detail

JaxpParser

public JaxpParser()
Method Detail

compose

public void compose(org.apache.avalon.framework.component.ComponentManager manager)
             throws org.apache.avalon.framework.component.ComponentException
Get the Entity Resolver from the component manager
Specified by:
compose in interface org.apache.avalon.framework.component.Composable

parameterize

public void parameterize(org.apache.avalon.framework.parameters.Parameters params)
Configure
Specified by:
parameterize in interface org.apache.avalon.framework.parameters.Parameterizable

parse

public void parse(org.xml.sax.InputSource in,
                  org.xml.sax.ContentHandler consumer)
           throws org.xml.sax.SAXException,
                  java.io.IOException
Description copied from interface: Parser
Parse the InputSource and send SAX events to the consumer. Attention: the consumer can either be an XMLConsumer or implement the LexicalHandler as well. The parse should take care of this.
Specified by:
parse in interface Parser

parseDocument

public org.w3c.dom.Document parseDocument(org.xml.sax.InputSource input)
                                   throws org.xml.sax.SAXException,
                                          java.io.IOException
Parses a new Document object from the given InputSource.
Specified by:
parseDocument in interface Parser

setupXMLReader

protected void setupXMLReader()
                       throws org.xml.sax.SAXException
Creates a new XMLReader if needed.

setupDocumentBuilder

protected void setupDocumentBuilder()
                             throws org.xml.sax.SAXException
Creates a new DocumentBuilder if needed.

error

public void error(org.xml.sax.SAXParseException e)
           throws org.xml.sax.SAXException
Receive notification of a recoverable error.
Specified by:
error in interface org.xml.sax.ErrorHandler

fatalError

public void fatalError(org.xml.sax.SAXParseException e)
                throws org.xml.sax.SAXException
Receive notification of a fatal error.
Specified by:
fatalError in interface org.xml.sax.ErrorHandler

warning

public void warning(org.xml.sax.SAXParseException e)
             throws org.xml.sax.SAXException
Receive notification of a warning.
Specified by:
warning in interface org.xml.sax.ErrorHandler


Copyright 2001 Apache Jakarta Project. All Rights Reserved.