gnu.xml.pipeline
Class TextConsumer

java.lang.Object
  |
  +--gnu.xml.util.XMLWriter
        |
        +--gnu.xml.pipeline.TextConsumer
All Implemented Interfaces:
ContentHandler, DeclHandler, DTDHandler, EventConsumer, LexicalHandler

public class TextConsumer
extends XMLWriter
implements EventConsumer

Terminates a pipeline, consuming events to print them as well formed XML (or XHTML) text.

Input must be well formed, and must include XML names (e.g. the prefixes and prefix declarations must be present), or the output of this class is undefined.

Version:
$Date: 2001/07/10 21:23:38 $
Author:
David Brownell
See Also:
NSFilter, WellFormednessFilter

Constructor Summary
TextConsumer(java.io.OutputStream out)
          Constructs a consumer that writes its input as XML text, encoded in UTF-8.
TextConsumer(java.io.Writer w)
          Constructs a consumer that writes its input as XML text.
TextConsumer(java.io.Writer w, boolean isXhtml)
          Constructs an event consumer which echoes its input as text, optionally adhering to some basic XHTML formatting options which increase interoperability with old (v3) browsers.
 
Method Summary
 ContentHandler getContentHandler()
          EventConsumer Returns the document handler being used.
 DTDHandler getDTDHandler()
          EventConsumer Returns the dtd handler being used.
 java.lang.Object getProperty(java.lang.String propertyId)
          XMLReaderRetrieves a property (lexical and decl handlers)
 
Methods inherited from class gnu.xml.util.XMLWriter
attributeDecl, characters, comment, elementDecl, endCDATA, endDocument, endDTD, endElement, endEntity, endPrefixMapping, externalEntityDecl, fatal, flush, ignorableWhitespace, internalEntityDecl, isCanonical, isExpandingEntities, isPrettyPrinting, isXhtml, notationDecl, processingInstruction, setCanonical, setDocumentLocator, setEOL, setErrorHandler, setExpandingEntities, setPrettyPrinting, setWriter, setXhtml, skippedEntity, startCDATA, startDocument, startDTD, startElement, startEntity, startPrefixMapping, unparsedEntityDecl, write, writeElement, writeElement, writeEmptyElement
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface gnu.xml.pipeline.EventConsumer
setErrorHandler
 

Constructor Detail

TextConsumer

public TextConsumer(java.io.Writer w,
                    boolean isXhtml)
             throws java.io.IOException
Constructs an event consumer which echoes its input as text, optionally adhering to some basic XHTML formatting options which increase interoperability with old (v3) browsers.

For the best interoperability, when writing as XHTML only ASCII characters are emitted; other characters are turned to entity or character references as needed, and no XML declaration is provided in the document.


TextConsumer

public TextConsumer(java.io.Writer w)
             throws java.io.IOException
Constructs a consumer that writes its input as XML text. XHTML rules are not followed.

TextConsumer

public TextConsumer(java.io.OutputStream out)
             throws java.io.IOException
Constructs a consumer that writes its input as XML text, encoded in UTF-8. XHTML rules are not followed.
Method Detail

getContentHandler

public ContentHandler getContentHandler()
EventConsumer Returns the document handler being used.
Specified by:
getContentHandler in interface EventConsumer

getDTDHandler

public DTDHandler getDTDHandler()
EventConsumer Returns the dtd handler being used.
Specified by:
getDTDHandler in interface EventConsumer

getProperty

public java.lang.Object getProperty(java.lang.String propertyId)
                             throws SAXNotRecognizedException
XMLReaderRetrieves a property (lexical and decl handlers)
Specified by:
getProperty in interface EventConsumer
Following copied from interface: gnu.xml.pipeline.EventConsumer
Parameters:
id - This is a URI identifying the type of property desired.
Returns:
The value of that property, if it is defined.
Throws:
SAXNotRecognizedException - Thrown if the particular pipeline stage does not understand the specified identifier.

Source code is GPL'd in the JAXP subproject at http://savannah.gnu.org/projects/classpathx
This documentation was derived from that source code on 2001-07-12.