mirceatoma 2002/10/12 20:27:18
Added: xmlutil/src/java/org/apache/excalibur/xml/sax
XMLConsumerAdapter.java
Log:
Thread safe XMLConsumer wrapper.
Revision Changes Path
1.1
jakarta-avalon-excalibur/xmlutil/src/java/org/apache/excalibur/xml/sax/XMLConsumerAdapter.java
Index: XMLConsumerAdapter.java
===================================================================
/*
* Copyright (C) The Apache Software Foundation. All rights reserved.
*
* This software is published under the terms of the Apache Software License
* version 1.1, a copy of which has been included with this distribution in
* the LICENSE.txt file.
*/
package org.apache.excalibur.xml.sax;
import org.xml.sax.Attributes;
import org.xml.sax.ContentHandler;
import org.xml.sax.Locator;
import org.xml.sax.SAXException;
import org.xml.sax.ext.LexicalHandler;
/**
* This class is an utility class "wrapping" around a SAX version 2.0
* {@link ContentHandler} and forwarding it those events received throug
* its {@link XMLConsumer}s interface.
* <br>
*
* @author <a href="mailto:[EMAIL PROTECTED]">Mircea Toma</a>
* @version CVS $Revision: 1.1 $ $Date: 2002/10/13 03:27:18 $
*/
public class XMLConsumerAdapter extends ContentHandlerAdapter implements XMLConsumer
{
/** The {@link LexicalHandler} */
private LexicalHandler m_lexicalHandler;
/**
* Create a new <code>XMLConsumerAdapter</code> instance.
*/
public XMLConsumerAdapter(final ContentHandler contentHandler, final
LexicalHandler lexicalHandler)
{
super(contentHandler);
m_lexicalHandler = lexicalHandler;
}
/**
* Report the start of DTD declarations, if any.
*
* @param name The document type name.
* @param publicId The declared public identifier for the external DTD
* subset, or null if none was declared.
* @param systemId The declared system identifier for the external DTD
* subset, or null if none was declared.
*/
public void startDTD( final String name,
final String publicId,
final String systemId )
throws SAXException
{
m_lexicalHandler.startDTD( name, publicId, systemId );
}
/**
* Report the end of DTD declarations.
*/
public void endDTD()
throws SAXException
{
m_lexicalHandler.endDTD();
}
/**
* Report the beginning of an entity.
*
* @param name The name of the entity. If it is a parameter entity, the
* name will begin with '%'.
*/
public void startEntity( final String name )
throws SAXException
{
m_lexicalHandler.startEntity( name );
}
/**
* Report the end of an entity.
*
* @param name The name of the entity that is ending.
*/
public void endEntity( final String name )
throws SAXException
{
m_lexicalHandler.endEntity( name );
}
/**
* Report the start of a CDATA section.
*/
public void startCDATA()
throws SAXException
{
m_lexicalHandler.startCDATA();
}
/**
* Report the end of a CDATA section.
*/
public void endCDATA()
throws SAXException
{
m_lexicalHandler.endCDATA();
}
/**
* Report an XML comment anywhere in the document.
*
* @param ch An array holding the characters in the comment.
* @param start The starting position in the array.
* @param len The number of characters to use from the array.
*/
public void comment( final char[] ch,
final int start,
final int len )
throws SAXException
{
m_lexicalHandler.comment( ch, start, len );
}
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>