Package com.nwalsh.saxon

# Class CopyEmitter

java.lang.Object
com.icl.saxon.output.Emitter
com.nwalsh.saxon.CopyEmitter

All Implemented Interfaces:
  `Result`

Direct Known Subclasses:
  `CalloutEmitter`, `ColumnUpdateEmitter`, `NumberLinesEmitter`, `UnwrapLinksEmitter`

public class CopyEmitter extends com.icl.saxon.output.Emitter

A Saxon 6.0 Emitter that clones its input.

$Id: CopyEmitter.java 5907 2006-04-27 08:26:47Z xmldoc $

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 Also:
  - `CalloutEmitter`
  - `NumberLinesEmitter`

## Field Summary

Fields
Modifier and Type
Field
Description
`protected com.icl.saxon.om.NamePool`
`namePool`
The namePool.
`protected com.icl.saxon.expr.FragmentValue`
`rtf`
The result tree fragment containing the copied fragment.
`protected com.icl.saxon.output.Emitter`
`rtfEmitter`

### Fields inherited from class com.icl.saxon.output.Emitter

`locator, outputProperties, outputStream, systemId, writer`

### Fields inherited from interface javax.xml.transform.Result

`PI_DISABLE_OUTPUT_ESCAPING, PI_ENABLE_OUTPUT_ESCAPING`

## Constructor Summary

Constructors
Constructor
Description
`CopyEmitter(com.icl.saxon.Controller controller, com.icl.saxon.om.NamePool namePool)`
Constructor for the CopyEmitter.

## Method Summary

Modifier and Type
Method
Description
`void`
`characters(char[] chars, int start, int len)`
Copy characters.
`void`
`comment(char[] chars, int start, int length)`
Copy comments.
`void`
`endDocument()`
Copy end document events.
`void`
`endElement(int nameCode)`
Copy end element events.
`com.icl.saxon.expr.FragmentValue`
`getResultTreeFragment()`
Return the result tree fragment constructed by replaying events through this emitter.
`void`
`processingInstruction(String name, String data)`
Copy processing instructions.
`void`
`setDocumentLocator(Locator locator)`
Copy set document locator events.
`void`
`setEscaping(boolean escaping)`
Copy set escaping events.
`void`
`setNamePool(com.icl.saxon.om.NamePool namePool)`
Copy set name pool events.
`void`
`setUnparsedEntity(String name, String uri)`
Copy set unparsed entity events.
`void`
`setWriter(Writer writer)`
Copy set writer events.
`void`
`startDocument()`
Copy start document events.
`void`
`startElement(int nameCode, Attributes attributes, int[] namespaces, int nscount)`
Copy start element events.

### Methods inherited from class com.icl.saxon.output.Emitter

`getNamePool, getOutputProperties, getOutputStream, getSystemId, getWriter, makeEmitter, setOutputProperties, setOutputStream, setSystemId, usesWriter`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### rtf

protected com.icl.saxon.expr.FragmentValue rtf
The result tree fragment containing the copied fragment.

### rtfEmitter

protected com.icl.saxon.output.Emitter rtfEmitter

### namePool

protected com.icl.saxon.om.NamePool namePool

The namePool.

Copied from the caller, it should be the runtime name pool.

## Constructor Details

### CopyEmitter

public CopyEmitter(com.icl.saxon.Controller controller, com.icl.saxon.om.NamePool namePool)

Constructor for the CopyEmitter.

Parameters:
  `namePool` - The name pool to use for constructing elements and attributes.

## Method Details

### getResultTreeFragment

public com.icl.saxon.expr.FragmentValue getResultTreeFragment()

Return the result tree fragment constructed by replaying events through this emitter.

### characters

public void characters(char[] chars, int start, int len) throws TransformerException
Copy characters.

Specified by:
  `characters` in class `com.icl.saxon.output.Emitter`
Throws:
  `TransformerException`

### comment

public void comment(char[] chars, int start, int length) throws TransformerException
Copy comments.

Specified by:
  `comment` in class `com.icl.saxon.output.Emitter`
Throws:
  `TransformerException`

### endDocument

public void endDocument() throws TransformerException
Copy end document events.

Specified by:
  `endDocument` in class `com.icl.saxon.output.Emitter`
Throws:
  `TransformerException`

### endElement

public void endElement(int nameCode) throws TransformerException
Copy end element events.

Specified by:
  `endElement` in class `com.icl.saxon.output.Emitter`
Throws:
  `TransformerException`

### processingInstruction

public void processingInstruction(String name, String data) throws TransformerException
Copy processing instructions.

Specified by:
  `processingInstruction` in class `com.icl.saxon.output.Emitter`
Throws:
  `TransformerException`

### setDocumentLocator

public void setDocumentLocator(Locator locator)
Copy set document locator events.

Overrides:
  `setDocumentLocator` in class `com.icl.saxon.output.Emitter`

### setEscaping

public void setEscaping(boolean escaping) throws TransformerException
Copy set escaping events.

Overrides:
  `setEscaping` in class `com.icl.saxon.output.Emitter`
Throws:
  `TransformerException`

### setNamePool

public void setNamePool(com.icl.saxon.om.NamePool namePool)
Copy set name pool events.

Overrides:
  `setNamePool` in class `com.icl.saxon.output.Emitter`

### setUnparsedEntity

public void setUnparsedEntity(String name, String uri) throws TransformerException
Copy set unparsed entity events.

Overrides:
  `setUnparsedEntity` in class `com.icl.saxon.output.Emitter`
Throws:
  `TransformerException`

### setWriter

public void setWriter(Writer writer)
Copy set writer events.

Overrides:
  `setWriter` in class `com.icl.saxon.output.Emitter`

### startDocument

public void startDocument() throws TransformerException
Copy start document events.

Specified by:
  `startDocument` in class `com.icl.saxon.output.Emitter`
Throws:
  `TransformerException`

### startElement

public void startElement(int nameCode, Attributes attributes, int[] namespaces, int nscount) throws TransformerException
Copy start element events.

Specified by:
  `startElement` in class `com.icl.saxon.output.Emitter`
Throws:
  `TransformerException`