| java.lang.Object org.geotools.xml.transform.TransformerBase
All known Subclasses: org.geotools.gml.producer.GeometryTransformer, org.geotools.styling.SLDTransformer, org.geotools.gml.producer.FeatureTypeTransformer, org.geotools.filter.FilterTransformer, org.geotools.gml.producer.FeatureTransformer,
TransformerBase | abstract public class TransformerBase (Code) | | TransformerBase provides support for writing Object->XML encoders. The basic
pattern for useage is to extend TransformerBase and implement the
createTranslator(ContentHandler) method. This is easiest done by extending
the inner class TranslatorSupport. A Translator uses a ContentHandler to
issue SAX events to a javax.xml.transform.Transformer. If possible, make
the translator public so it can be used by others as well.
author: Ian Schneider |
Inner Class :public class Task implements Runnable | |
Inner Class :abstract protected static class TranslatorSupport implements Translator | |
Inner Class :public static class SchemaLocationSupport | |
Inner Class :protected static class XMLReaderSupport extends XMLFilterImpl | |
XMLNS_NAMESPACE | final public static String XMLNS_NAMESPACE(Code) | | |
createTransformTask | public Task createTransformTask(Object object, StreamResult result) throws TransformerException(Code) | | Create a Transformation task. This is a Runnable task
which supports aborting any processing. It will not start until the
run method is called.
|
createXMLReader | public XMLReaderSupport createXMLReader(Object object)(Code) | | Create an XMLReader to use in the transformation.
|
getEncoding | public Charset getEncoding()(Code) | | Gets the charset to declare in the header of the response.
the charset to encode with. |
getIndentation | public int getIndentation()(Code) | | Get the number of spaces to indent the output xml. Defaults to -1.
The number of spaces to indent, or -1, to disable. |
isNamespaceDeclartionEnabled | public boolean isNamespaceDeclartionEnabled()(Code) | | Should this transformer declare namespace prefixes in the first element
it outputs? Defaults to true.
true if namespaces will be declared, false otherwise |
isOmitXMLDeclaration | public boolean isOmitXMLDeclaration()(Code) | | Will this transformation omit the standard XML declaration. Defaults
to false
true if the XML declaration will be omitted, false otherwise. |
setEncoding | public void setEncoding(Charset charset)(Code) | | Sets the charset to declare in the xml header returned.
Parameters: charset - A charset object of the desired encoding |
setIndentation | public void setIndentation(int amt)(Code) | | Set the number of spaces to indent the output xml. Default to -1.
Parameters: amt - The number of spaces to indent if > 0, otherwise disable. |
setNamespaceDeclarationEnabled | public void setNamespaceDeclarationEnabled(boolean enabled)(Code) | | Enable declaration of namespace prefixes in the first element. Defaults
to true;
Parameters: enabled - Enable namespace declaration. |
setOmitXMLDeclaration | public void setOmitXMLDeclaration(boolean xmlDecl)(Code) | | Set this transformer to omit/include the XML declaration. Defaults to
false
Parameters: xmlDecl - Omit/include the XML declaration. |
transform | public void transform(Object object, StreamResult result) throws TransformerException(Code) | | Perform the XML encoding on the given object to the given OutputStream.
Calls createTransformer(),createXMLReader() and
Transformer.transform().
|
transform | public String transform(Object object) throws TransformerException(Code) | | Perform the XML encoding of the given object into an internal buffer and
return the resulting String. Calls transform(Object,Writer). It
should be noted the most efficient mechanism of encoding is using the
OutputStream or Writer methods
|
|
|