
com.nwalsh.saxon.CopyEmitter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of docbook-xsl-saxon Show documentation
Show all versions of docbook-xsl-saxon Show documentation
These are Java extensions for use with the DocBook XML stylesheets and the Saxon XSLT engine.
The newest version!
package com.nwalsh.saxon;
import javax.xml.transform.TransformerException;
import com.icl.saxon.Controller;
import com.icl.saxon.expr.FragmentValue;
import com.icl.saxon.om.NamePool;
import com.icl.saxon.output.Emitter;
/**
* A Saxon 6.0 Emitter that clones its input.
*
* $Id: CopyEmitter.java 8098 2008-08-03 13:27:07Z mzjn $
*
* Copyright (C) 2000 Norman Walsh.
*
* This class provides a
* Saxon 6.*
* implementation of an emitter that manufactures a cloned result
* tree fragment.
*
* The purpose of this emitter is to provide something for
* CalloutEmitter and NumberLinesEmitter to extend.
* This emitter simply copies all input to a new result tree fragment.
*
* Change Log:
*
* - 1.0
* Initial release.
*
*
* @see CalloutEmitter
* @see NumberLinesEmitter
*
* @author Norman Walsh
* [email protected]
*
* @version $Id: CopyEmitter.java 8098 2008-08-03 13:27:07Z mzjn $
*
*/
public class CopyEmitter extends com.icl.saxon.output.Emitter {
/** The result tree fragment containing the copied fragment. */
protected FragmentValue rtf = null;
protected Emitter rtfEmitter = null;
/** The namePool.
*
* Copied from the caller, it should be the runtime name pool.
*/
protected NamePool namePool = null;
/** Constructor for the CopyEmitter.
*
* @param namePool The name pool to use for constructing elements and attributes.
*/
public CopyEmitter(Controller controller, NamePool namePool) {
rtf = new FragmentValue(controller);
rtfEmitter = rtf.getEmitter();
this.namePool = namePool;
}
/**
* Return the result tree fragment constructed by replaying events
* through this emitter.
*/
public FragmentValue getResultTreeFragment() {
return rtf;
}
/** Copy characters. */
public void characters(char[] chars, int start, int len)
throws TransformerException {
rtfEmitter.characters(chars, start, len);
}
/** Copy comments. */
public void comment(char[] chars, int start, int length)
throws TransformerException {
rtfEmitter.comment(chars, start, length);
}
/** Copy end document events. */
public void endDocument()
throws TransformerException {
rtfEmitter.endDocument();
}
/** Copy end element events. */
public void endElement(int nameCode)
throws TransformerException {
rtfEmitter.endElement(nameCode);
}
/** Copy processing instructions. */
public void processingInstruction(java.lang.String name,
java.lang.String data)
throws TransformerException {
rtfEmitter.processingInstruction(name, data);
}
/** Copy set document locator events. */
public void setDocumentLocator(org.xml.sax.Locator locator) {
rtfEmitter.setDocumentLocator(locator);
}
/** Copy set escaping events. */
public void setEscaping(boolean escaping)
throws TransformerException {
rtfEmitter.setEscaping(escaping);
}
/** Copy set name pool events. */
public void setNamePool(NamePool namePool) {
rtfEmitter.setNamePool(namePool);
}
/** Copy set unparsed entity events. */
public void setUnparsedEntity(java.lang.String name, java.lang.String uri)
throws TransformerException {
rtfEmitter.setUnparsedEntity(name, uri);
}
/** Copy set writer events. */
public void setWriter(java.io.Writer writer) {
rtfEmitter.setWriter(writer);
}
/** Copy start document events. */
public void startDocument()
throws TransformerException {
rtfEmitter.startDocument();
}
/** Copy start element events. */
public void startElement(int nameCode,
org.xml.sax.Attributes attributes,
int[] namespaces,
int nscount)
throws TransformerException {
rtfEmitter.startElement(nameCode, attributes, namespaces, nscount);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy