org.apache.cocoon.xml
Interface XMLConsumer

All Superinterfaces:
ContentHandler, LexicalHandler, XMLConsumer
All Known Subinterfaces:
AttributeAwareXMLConsumer, Serializer, SerializerFactory.Instance, Transformer, TransformerFactory.Instance, TransformerTag, XMLConsumerTag, XMLPipe, XMLSerializer
All Known Implementing Classes:
AbstractSerializer, AbstractTransformer, AbstractXMLConsumer, AbstractXMLPipe, AttributeAwareXMLConsumerImpl, ElementProcessorSerializer, EncodingSerializer, ExtendedParserTransformer, FormsTemplateTransformer, IncludeTransformer, IncludeXMLConsumer, LexicalTransformer, LinkGatherer, LinkSerializer, LinkTranslator, NOPRecorder, ParserTransformer, ProfilingXMLPipe, SaxBuffer, SVGBuilder, SVGSerializer, TagTransformer, TransformerTagSupport, URLRewriter, VarTransformerTagSupport, VirtualPipelineSerializer, VirtualPipelineTransformer, XMLByteStreamCompiler, XMLConsumerTagSupport, XMLMulticaster, XMLTeePipe

public interface XMLConsumer
extends XMLConsumer

This interfaces identifies classes that consume XML data, receiving notification of SAX events.

An XMLConsumer is also a SAX ContentHandler and a SAX LexicalHandler. That means the XMLConsumer has to respect all the contracts with the SAX interfaces. SAX stands for Serialized API for XML. A document start, and each element start must be matched by the corresponding element end or document end. So why does Cocoon use SAX instead of manipulating a DOM? For two main reasons: performance and scalability. A DOM tree is much more heavy on system memory than successive calls to an API. SAX events can be sent as soon as they are read from the originating XML, the parsing and processing can happen essentially at the same time.

Most people's needs will be handled just fine with the ContentHandler interface, as that declares your namespaces. However if you need lexical support to resolve entity names and such, you need the LexicalHandler interface. The AbstractXMLConsumer base class can make implementing this interface easier so that you only need to override the events you intend to do anything with.

Version:
CVS $Id: XMLConsumer.java 279586 2005-09-08 17:12:20Z bloritsch $
Author:
Pierpaolo Fumagalli (Apache Software Foundation)

Methods inherited from interface org.xml.sax.ContentHandler
characters, endDocument, endElement, endPrefixMapping, ignorableWhitespace, processingInstruction, setDocumentLocator, skippedEntity, startDocument, startElement, startPrefixMapping
 
Methods inherited from interface org.xml.sax.ext.LexicalHandler
comment, endCDATA, endDTD, endEntity, startCDATA, startDTD, startEntity
 



Copyright ? 1999-2005 The Apache Software Foundation. All Rights Reserved.