|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.saxon.lib.SerializerFactory
public class SerializerFactory
Helper class to construct a serialization pipeline for a given result destination and a given set of output properties. The pipeline is represented by a Receiver object to which result tree events are sent. Since Saxon 8.8 is is possible to write a subclass of SerializerFactory and register it with the Configuration, allowing customisation of the Serializer pipeline. The class includes methods for instantiating each of the components used on the Serialization pipeline. This allows a customized SerializerFactory to replace any or all of these components by subclasses that refine the behaviour.
Constructor Summary | |
---|---|
SerializerFactory(Configuration config)
Create a SerializerFactory |
Method Summary | |
---|---|
Receiver |
addTextOutputFilter(Receiver next,
Properties properties)
Add a filter to the text output method pipeline. |
protected Receiver |
createHTMLSerializer(Emitter emitter,
Properties props,
PipelineConfiguration pipe,
CharacterMapExpander characterMapExpander,
ProxyReceiver normalizer)
Create a serialization pipeline to implement the HTML output method. |
protected Receiver |
createSaxonSerializationMethod(String method,
Properties props,
PipelineConfiguration pipe,
CharacterMapExpander characterMapExpander,
ProxyReceiver normalizer)
|
protected Receiver |
createTextSerializer(Emitter emitter,
Properties props,
CharacterMapExpander characterMapExpander,
ProxyReceiver normalizer)
Create a serialization pipeline to implement the text output method. |
protected Receiver |
createUserDefinedOutputMethod(String method,
Properties props,
PipelineConfiguration pipe)
Create a serialization pipeline to implement a user-defined output method. |
protected Receiver |
createXHTMLSerializer(Emitter emitter,
Properties props,
PipelineConfiguration pipe,
CharacterMapExpander characterMapExpander,
ProxyReceiver normalizer)
Create a serialization pipeline to implement the XHTML output method. |
protected Receiver |
createXMLSerializer(XMLEmitter emitter,
Properties props,
PipelineConfiguration pipe,
CharacterMapExpander characterMapExpander,
ProxyReceiver normalizer)
Create a serialization pipeline to implement the XML output method. |
Receiver |
getReceiver(Result result,
PipelineConfiguration pipe,
Properties props)
Get a Receiver that wraps a given Result object. |
Receiver |
getReceiver(Result result,
PipelineConfiguration pipe,
Properties props,
CharacterMapIndex charMapIndex)
Get a Receiver that wraps a given Result object. |
XMLStreamWriter |
getXMLStreamWriter(StreamResult result,
Properties properties)
Create a serializer with given output properties, and return an XMLStreamWriter that can be used to feed events to the serializer. |
protected ProxyReceiver |
newCDATAFilter(Receiver next,
Properties outputProperties)
Create a new CDATA Filter, responsible for insertion of CDATA sections where required. |
CharacterMapExpander |
newCharacterMapExpander(Receiver next)
Create a new CharacterMapExpander. |
protected ContentHandlerProxy |
newContentHandlerProxy()
Create a ContentHandlerProxy. |
protected Emitter |
newHTMLEmitter(Properties properties)
Create a new HTML Emitter. |
protected ProxyReceiver |
newHTMLIndenter(Receiver next,
Properties outputProperties)
Create a new HTML Indenter. |
protected MetaTagAdjuster |
newHTMLMetaTagAdjuster(Receiver next,
Properties outputProperties)
Create a new XHTML MetaTagAdjuster, responsible for insertion, removal, or replacement of meta elements. |
protected ProxyReceiver |
newHTMLURIEscaper(Receiver next,
Properties outputProperties)
Create a new HTML URI Escaper, responsible for percent-encoding of URIs in HTML output documents. |
protected Emitter |
newTEXTEmitter()
Create a new Text Emitter. |
protected UncommittedSerializer |
newUncommittedSerializer(Result result,
Receiver next,
Properties properties)
Create an UncommittedSerializer. |
protected ProxyReceiver |
newUnicodeNormalizer(Receiver next,
Properties outputProperties)
Create a Unicode Normalizer. |
protected Emitter |
newXHTMLEmitter(Properties properties)
Create a new XHTML Emitter. |
protected ProxyReceiver |
newXHTMLIndenter(Receiver next,
Properties outputProperties)
Create a new XHTML Indenter. |
protected MetaTagAdjuster |
newXHTMLMetaTagAdjuster(Receiver next,
Properties outputProperties)
Create a new XHTML MetaTagAdjuster, responsible for insertion, removal, or replacement of meta elements. |
protected ProxyReceiver |
newXHTMLURIEscaper(Receiver next,
Properties outputProperties)
Create a new XHTML URI Escaper, responsible for percent-encoding of URIs in HTML output documents. |
protected ProxyReceiver |
newXML10ContentChecker(Receiver next,
Properties outputProperties)
Create a new XML 1.0 content checker, responsible for checking that the output conforms to XML 1.0 rules (this is used only if the Configuration supports XML 1.1 but the specific output file requires XML 1.0). |
protected Emitter |
newXMLEmitter(Properties properties)
Create a new XML Emitter. |
protected ProxyReceiver |
newXMLIndenter(XMLEmitter next,
Properties outputProperties)
Create a new XML Indenter. |
Result |
prepareNextStylesheet(Controller controller,
String href,
String baseURI,
Result result)
Prepare another stylesheet to handle the output of this one. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SerializerFactory(Configuration config)
config
- the Saxon ConfigurationMethod Detail |
---|
public XMLStreamWriter getXMLStreamWriter(StreamResult result, Properties properties) throws XPathException
result
- the destination of the serialized output (wraps a Writer, an OutputStream, or a File)properties
- the serialization properties to be used
XPathException
- if any error occurspublic Receiver getReceiver(Result result, PipelineConfiguration pipe, Properties props) throws XPathException
Note that this method ignores the SaxonOutputKeys.WRAP
output property. If
wrapped output is required, the user must create a SequenceWrapper
directly.
result
- The final destination of the serialized output. Usually a StreamResult,
but other kinds of Result are possible.pipe
- The PipelineConfiguration.props
- The serialization properties. If this includes the property SaxonOutputKeys.USE_CHARACTER_MAPS
then the PipelineConfiguration must contain a non-null Controller, and the Executable associated with this Controller
must have a CharacterMapIndex which is used to resolve the names of the character maps appearing in this property.
XPathException
- if any failure occurspublic Receiver getReceiver(Result result, PipelineConfiguration pipe, Properties props, CharacterMapIndex charMapIndex) throws XPathException
Note that this method ignores the SaxonOutputKeys.WRAP
output property. If
wrapped output is required, the user must create a SequenceWrapper
directly.
result
- The final destination of the serialized output. Usually a StreamResult,
but other kinds of Result are possible.pipe
- The PipelineConfiguration.props
- The serialization propertiescharMapIndex
- The index of character maps. Required if any of the serialization properties
is SaxonOutputKeys.USE_CHARACTER_MAPS
, in which case the named character maps listed in that
property must be present in the index of character maps.
XPathException
protected Receiver createHTMLSerializer(Emitter emitter, Properties props, PipelineConfiguration pipe, CharacterMapExpander characterMapExpander, ProxyReceiver normalizer) throws XPathException
emitter
- the emitter at the end of the pipeline (created using the method newHTMLEmitter(java.util.Properties)
props
- the serialization propertiespipe
- the pipeline configuration informationcharacterMapExpander
- the filter to be used for expanding character maps defined in the stylesheetnormalizer
- the filter used for Unicode normalization
XPathException
- if a failure occursprotected Receiver createTextSerializer(Emitter emitter, Properties props, CharacterMapExpander characterMapExpander, ProxyReceiver normalizer) throws XPathException
emitter
- the emitter at the end of the pipeline (created using the method newTEXTEmitter()
props
- the serialization propertiescharacterMapExpander
- the filter to be used for expanding character maps defined in the stylesheetnormalizer
- the filter used for Unicode normalization
XPathException
- if a failure occursprotected Receiver createXHTMLSerializer(Emitter emitter, Properties props, PipelineConfiguration pipe, CharacterMapExpander characterMapExpander, ProxyReceiver normalizer) throws XPathException
emitter
- the emitter at the end of the pipeline (created using the method newXHTMLEmitter(java.util.Properties)
props
- the serialization propertiespipe
- the pipeline configuration informationcharacterMapExpander
- the filter to be used for expanding character maps defined in the stylesheetnormalizer
- the filter used for Unicode normalization
XPathException
- if a failure occursprotected Receiver createXMLSerializer(XMLEmitter emitter, Properties props, PipelineConfiguration pipe, CharacterMapExpander characterMapExpander, ProxyReceiver normalizer) throws XPathException
emitter
- the emitter at the end of the pipeline (created using the method newXHTMLEmitter(java.util.Properties)
props
- the serialization propertiespipe
- the pipeline configuration informationcharacterMapExpander
- the filter to be used for expanding character maps defined in the stylesheetnormalizer
- the filter used for Unicode normalization
XPathException
- if a failure occursprotected Receiver createSaxonSerializationMethod(String method, Properties props, PipelineConfiguration pipe, CharacterMapExpander characterMapExpander, ProxyReceiver normalizer) throws XPathException
XPathException
protected Receiver createUserDefinedOutputMethod(String method, Properties props, PipelineConfiguration pipe) throws XPathException
method
- the name of the user-defined output method, as a QName in Clark format
(that is "{uri}local").props
- the serialization propertiespipe
- the pipeline configuration information
XPathException
- if a failure occursprotected ContentHandlerProxy newContentHandlerProxy()
protected UncommittedSerializer newUncommittedSerializer(Result result, Receiver next, Properties properties)
result
- the result destinationnext
- the next receiver in the pipelineproperties
- the serialization properties
protected Emitter newXMLEmitter(Properties properties)
properties
- the output properties
protected Emitter newHTMLEmitter(Properties properties)
properties
- the output properties
protected Emitter newXHTMLEmitter(Properties properties)
properties
- the output properties
public Receiver addTextOutputFilter(Receiver next, Properties properties) throws XPathException
next
- the next receiver (typically the TextEmitter)properties
- the output properties
XPathException
protected Emitter newTEXTEmitter()
protected ProxyReceiver newXMLIndenter(XMLEmitter next, Properties outputProperties)
next
- the next receiver in the pipelineoutputProperties
- the serialization parameters
protected ProxyReceiver newHTMLIndenter(Receiver next, Properties outputProperties)
next
- the next receiver in the pipelineoutputProperties
- the serialization parameters
protected ProxyReceiver newXHTMLIndenter(Receiver next, Properties outputProperties)
next
- the next receiver in the pipelineoutputProperties
- the serialization parameters
protected MetaTagAdjuster newXHTMLMetaTagAdjuster(Receiver next, Properties outputProperties)
next
- the next receiver in the pipelineoutputProperties
- the serialization parameters
protected MetaTagAdjuster newHTMLMetaTagAdjuster(Receiver next, Properties outputProperties)
next
- the next receiver in the pipelineoutputProperties
- the serialization parameters
protected ProxyReceiver newHTMLURIEscaper(Receiver next, Properties outputProperties)
next
- the next receiver in the pipelineoutputProperties
- the serialization parameters
protected ProxyReceiver newXHTMLURIEscaper(Receiver next, Properties outputProperties)
next
- the next receiver in the pipelineoutputProperties
- the serialization parameters
protected ProxyReceiver newCDATAFilter(Receiver next, Properties outputProperties) throws XPathException
next
- the next receiver in the pipelineoutputProperties
- the serialization parameters
XPathException
- if an error occursprotected ProxyReceiver newXML10ContentChecker(Receiver next, Properties outputProperties)
next
- the next receiver in the pipelineoutputProperties
- the serialization parameters
protected ProxyReceiver newUnicodeNormalizer(Receiver next, Properties outputProperties) throws XPathException
next
- the next receiver in the pipelineoutputProperties
- the serialization parameters
XPathException
- if an error occurspublic CharacterMapExpander newCharacterMapExpander(Receiver next)
next
- the next receiver in the pipeline
public Result prepareNextStylesheet(Controller controller, String href, String baseURI, Result result) throws TransformerException
This method is intended for internal use, to support the
saxon:next-in-chain
extension.
controller
- the current transformationhref
- URI of the next stylesheet to be appliedbaseURI
- base URI for resolving href if it's a relative
URIresult
- the output destination of the current stylesheet
XPathException
- if any dynamic error occurs
TransformerException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |