Class ContentHandlerProxy
java.lang.Object
com.icl.saxon.output.Emitter
com.icl.saxon.output.ContentHandlerProxy
A ContentHandlerProxy is an Emitter that filters data before passing it to an
underlying SAX2 ContentHandler. Relevant events (notably comments) can also be
fed to a LexicalHandler.
Note that in general the output passed to an Emitter
corresponds to an External General Parsed Entity. A SAX2 ContentHandler only expects
to deal with well-formed XML documents, so we only pass it the contents of the first
element encountered.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ContentHandlerprotected LexicalHandlerprotected Locatorprotected booleanFields inherited from class Emitter
namePool, outputProperties, outputStream, systemId, writerFields inherited from interface Result
PI_DISABLE_OUTPUT_ESCAPING, PI_ENABLE_OUTPUT_ESCAPING -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcharacters(char[] chars, int start, int len) Character datavoidcomment(char[] ch, int start, int length) Output a comment.voidEnd of documentvoidendElement(int nameCode) End of elementintint/////////////////////////////////////////////////////////////////protected voidThe following function notifies the content handler, by means of a processing instruction, that the output is not a well-formed document.voidprocessingInstruction(String target, String data) Processing InstructionvoidsetDocumentLocator(Locator locator) Set Document LocatorvoidsetEscaping(boolean escaping) Switch escaping on or off.voidsetLexicalHandler(LexicalHandler handler) Set the Lexical Handler to be used.voidsetOutputProperties(Properties props) Set the output propertiesvoidsetRequireWellFormed(boolean wellFormed) Indicate whether the content handler can handle a stream of events that is merely well-balanced, or whether it can only handle a well-formed sequence.voidSet the underlying content handler.voidStart of documentvoidstartElement(int nameCode, Attributes atts, int[] namespaces, int nscount) Start of elementMethods inherited from class Emitter
getNamePool, getOutputProperties, getOutputStream, getSystemId, getWriter, makeEmitter, setNamePool, setOutputStream, setSystemId, setUnparsedEntity, setWriter, usesWriterMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Locator
getSystemId
-
Field Details
-
handler
-
lexicalHandler
-
locator
-
requireWellFormed
protected boolean requireWellFormed
-
-
Constructor Details
-
ContentHandlerProxy
public ContentHandlerProxy()
-
-
Method Details
-
setUnderlyingContentHandler
Set the underlying content handler. This call is mandatory before using the Emitter. -
setOutputProperties
Set the output properties- Overrides:
setOutputPropertiesin classEmitter
-
setLexicalHandler
Set the Lexical Handler to be used. If called, this must be called AFTER setUnderlyingContentHandler() -
setRequireWellFormed
public void setRequireWellFormed(boolean wellFormed) Indicate whether the content handler can handle a stream of events that is merely well-balanced, or whether it can only handle a well-formed sequence. -
setDocumentLocator
Set Document Locator- Overrides:
setDocumentLocatorin classEmitter
-
startDocument
Start of document- Specified by:
startDocumentin classEmitter- Throws:
TransformerException
-
endDocument
End of document- Specified by:
endDocumentin classEmitter- Throws:
TransformerException
-
startElement
public void startElement(int nameCode, Attributes atts, int[] namespaces, int nscount) throws TransformerException Start of element- Specified by:
startElementin classEmitter- Parameters:
namespaces- Array of namespace codes identifying the namespace prefix/uri pairs associated with this elementnscount- Number of significant entries within namespaces array- Throws:
TransformerException
-
endElement
End of element- Specified by:
endElementin classEmitter- Throws:
TransformerException
-
characters
Character data- Specified by:
charactersin classEmitter- Throws:
TransformerException
-
notifyNotWellFormed
The following function notifies the content handler, by means of a processing instruction, that the output is not a well-formed document. If the content handler responds with an exception containing the message "continue" (this is the only way it can get information back) then further events are notified, otherwise they are suppressed.- Throws:
SAXException
-
processingInstruction
Processing Instruction- Specified by:
processingInstructionin classEmitter- Throws:
TransformerException
-
comment
Output a comment. Passes it on to the ContentHandler provided that the ContentHandler is also a SAX2 LexicalHandler.- Specified by:
commentin classEmitter- Throws:
TransformerException
-
setEscaping
public void setEscaping(boolean escaping) Switch escaping on or off. This is called when the XSLT disable-output-escaping attribute is used to switch escaping on or off. It is not called for other sections of output (e.g. element names) where escaping is inappropriate. The action, as defined in JAXP 1.1, is to notify the request to the Content Handler using a processing instruction.- Overrides:
setEscapingin classEmitter
-
getPublicId
/////////////////////////////////////////////////////////////////- Specified by:
getPublicIdin interfaceLocator
-
getLineNumber
public int getLineNumber()- Specified by:
getLineNumberin interfaceLocator
-
getColumnNumber
public int getColumnNumber()- Specified by:
getColumnNumberin interfaceLocator
-