com.icl.saxon.output
Class DocumentHandlerProxy

java.lang.Object
  extended bycom.icl.saxon.output.Emitter
      extended bycom.icl.saxon.output.DocumentHandlerProxy
All Implemented Interfaces:
Result

public class DocumentHandlerProxy
extends Emitter

A DocumentHandlerProxy is an Emitter that filters data before passing it to an underlying SAX DocumentHandler. Note that in general the output passed to an Emitter corresponds to an External General Parsed Entity. A SAX DocumentHandler only expects to deal with well-formed XML documents, so we only pass it the contents of the first element encountered.


Field Summary
protected  org.xml.sax.DocumentHandler handler
           
protected  org.xml.sax.helpers.AttributeListImpl outputAtts
           
 
Fields inherited from class com.icl.saxon.output.Emitter
locator, namePool, outputProperties, outputStream, systemId, writer
 
Fields inherited from interface javax.xml.transform.Result
PI_DISABLE_OUTPUT_ESCAPING, PI_ENABLE_OUTPUT_ESCAPING
 
Constructor Summary
DocumentHandlerProxy()
           
 
Method Summary
 void characters(char[] chars, int start, int len)
          Character data
 void comment(char[] ch, int start, int length)
          Output a comment
 void endDocument()
          End of document
 void endElement(int nameCode)
          End of element
 void processingInstruction(java.lang.String target, java.lang.String data)
          Processing Instruction
 void setDocumentLocator(org.xml.sax.Locator locator)
          Set Document Locator
 void setUnderlyingDocumentHandler(org.xml.sax.DocumentHandler handler)
          Set the underlying document handler.
 void startDocument()
          Start of document
 void startElement(int nameCode, org.xml.sax.Attributes attributes, int[] namespaces, int nscount)
          Start of element
 
Methods inherited from class com.icl.saxon.output.Emitter
getNamePool, getOutputProperties, getOutputStream, getSystemId, getWriter, makeEmitter, setEscaping, setNamePool, setOutputProperties, setOutputStream, setSystemId, setUnparsedEntity, setWriter, usesWriter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

handler

protected org.xml.sax.DocumentHandler handler

outputAtts

protected org.xml.sax.helpers.AttributeListImpl outputAtts
Constructor Detail

DocumentHandlerProxy

public DocumentHandlerProxy()
Method Detail

setUnderlyingDocumentHandler

public void setUnderlyingDocumentHandler(org.xml.sax.DocumentHandler handler)
Set the underlying document handler. This call is mandatory before using the Emitter.


setDocumentLocator

public void setDocumentLocator(org.xml.sax.Locator locator)
Set Document Locator

Overrides:
setDocumentLocator in class Emitter

startDocument

public void startDocument()
                   throws TransformerException
Start of document

Specified by:
startDocument in class Emitter
Throws:
TransformerException

endDocument

public void endDocument()
                 throws TransformerException
End of document

Specified by:
endDocument in class Emitter
Throws:
TransformerException

startElement

public void startElement(int nameCode,
                         org.xml.sax.Attributes attributes,
                         int[] namespaces,
                         int nscount)
                  throws TransformerException
Start of element

Specified by:
startElement in class Emitter
Parameters:
namespaces - Array of namespace codes identifying the namespace prefix/uri pairs associated with this element
nscount - Number of significant entries within namespaces array
Throws:
TransformerException

endElement

public void endElement(int nameCode)
                throws TransformerException
End of element

Specified by:
endElement in class Emitter
Throws:
TransformerException

characters

public void characters(char[] chars,
                       int start,
                       int len)
                throws TransformerException
Character data

Specified by:
characters in class Emitter
Throws:
TransformerException

processingInstruction

public void processingInstruction(java.lang.String target,
                                  java.lang.String data)
                           throws TransformerException
Processing Instruction

Specified by:
processingInstruction in class Emitter
Throws:
TransformerException

comment

public void comment(char[] ch,
                    int start,
                    int length)
Output a comment

Specified by:
comment in class Emitter