|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
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.
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 |
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |