Class XMLAbstractTranscoder
java.lang.Object
org.apache.batik.transcoder.TranscoderSupport
org.apache.batik.transcoder.AbstractTranscoder
org.apache.batik.transcoder.XMLAbstractTranscoder
- All Implemented Interfaces:
Transcoder
- Direct Known Subclasses:
SVGAbstractTranscoder
This class may be the base class of all transcoders which take an
XML document as input and which need to build a DOM tree. In order
to take advantage of this class, you have to specify the following
transcoding hints:
KEY_DOM_IMPLEMENTATION: the DOM Implementation to useKEY_DOCUMENT_ELEMENT_NAMESPACE_URI: the namespace URI of the document to createKEY_DOCUMENT_ELEMENT: the qualified name of the document type to create
- Version:
- $Id$
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final TranscodingHints.KeyDocument element key.static final TranscodingHints.KeyDocument element namespace URI key.static final TranscodingHints.KeyDOM Implementation key.static final TranscodingHints.KeyXML parser classname key.static final TranscodingHints.KeyThe validation mode of the XML parser.Fields inherited from class TranscoderSupport
defaultErrorHandler, handler, hints -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedConstructs a newXMLAbstractTranscoder. -
Method Summary
Modifier and TypeMethodDescriptionprotected DocumentFactorycreateDocumentFactory(DOMImplementation domImpl, String parserClassname) Creates theDocumentFactoryused to create the DOM tree.voidtranscode(TranscoderInput input, TranscoderOutput output) Transcodes the specified XML input in the specified output.protected abstract voidtranscode(Document document, String uri, TranscoderOutput output) Transcodes the specified Document in the specified output.Methods inherited from class TranscoderSupport
addTranscodingHint, getErrorHandler, getTranscodingHints, removeTranscodingHint, setErrorHandler, setTranscodingHints, setTranscodingHintsMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Transcoder
addTranscodingHint, getErrorHandler, getTranscodingHints, removeTranscodingHint, setErrorHandler, setTranscodingHints, setTranscodingHints
-
Field Details
-
KEY_XML_PARSER_CLASSNAME
XML parser classname key.Key: KEY_XML_PARSER_CLASSNAME Value: String Default: null Required: Yes Description: Specify the XML parser classname to use. -
KEY_XML_PARSER_VALIDATING
The validation mode of the XML parser.Key: KEY_XML_PARSER_VALIDATING Value: Boolean Default: false Required: No Description: Specify the validation mode of the XML parser. -
KEY_DOCUMENT_ELEMENT
Document element key.Key: KEY_DOCUMENT_ELEMENT Value: String Default: null Required: Yes Description: Specify the qualified name of the document type to be created. -
KEY_DOCUMENT_ELEMENT_NAMESPACE_URI
Document element namespace URI key.Key: KEY_DOCUMENT_ELEMENT_NAMESPACE_URI Value: String Default: null Required: Yes Description: Specify the namespace URI of the document element. -
KEY_DOM_IMPLEMENTATION
DOM Implementation key.Key: KEY_DOM_IMPLEMENTATION Value: String Default: null Required: Yes Description: Specify the DOM Implementation to use.
-
-
Constructor Details
-
XMLAbstractTranscoder
protected XMLAbstractTranscoder()Constructs a newXMLAbstractTranscoder.
-
-
Method Details
-
transcode
Transcodes the specified XML input in the specified output. AllTranscoderExceptionexceptions not catched previously are tagged as fatal errors (ie. call thefatalErrormethod of theErrorHandler).- Parameters:
input- the XML input to transcodeoutput- the ouput where to transcode- Throws:
TranscoderException- if an error occured while transcoding
-
createDocumentFactory
Creates theDocumentFactoryused to create the DOM tree. Override this method if you have to use another implementation of theDocumentFactory(ie. for SVG, you have to use theSAXSVGDocumentFactory).- Parameters:
domImpl- the DOM Implementation to useparserClassname- the XML parser classname
-
transcode
protected abstract void transcode(Document document, String uri, TranscoderOutput output) throws TranscoderException Transcodes the specified Document in the specified output.- Parameters:
document- the document to transcodeuri- the uri of the document or null if anyoutput- the ouput where to transcode- Throws:
TranscoderException- if an error occured while transcoding
-