|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.geotools.xml.transform.TransformerBase
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.
Nested Class Summary | |
static class |
TransformerBase.SchemaLocationSupport
Adds support for schemaLocations. |
class |
TransformerBase.Task
A wrapper for a Transformation Task. |
protected static class |
TransformerBase.TranslatorSupport
Support for writing Translators. |
protected static class |
TransformerBase.XMLReaderSupport
Support for the setup of an XMLReader for use in a transformation. |
Constructor Summary | |
TransformerBase()
|
Method Summary | |
javax.xml.transform.Transformer |
createTransformer()
Create a Transformer which is initialized with the settings of this TransformerBase. |
TransformerBase.Task |
createTransformTask(java.lang.Object object,
javax.xml.transform.stream.StreamResult result)
Create a Transformation task. |
abstract Translator |
createTranslator(org.xml.sax.ContentHandler handler)
Create a Translator to issue SAXEvents to a ContentHandler. |
TransformerBase.XMLReaderSupport |
createXMLReader(java.lang.Object object)
Create an XMLReader to use in the transformation. |
java.nio.charset.Charset |
getEncoding()
Gets the charset to declare in the header of the response. |
int |
getIndentation()
Get the number of spaces to indent the output xml. |
boolean |
isNamespaceDeclartionEnabled()
Should this transformer declare namespace prefixes in the first element it outputs? |
boolean |
isOmitXMLDeclaration()
Will this transformation omit the standard XML declaration. |
void |
setEncoding(java.nio.charset.Charset charset)
Sets the charset to declare in the xml header returned. |
void |
setIndentation(int amt)
Set the number of spaces to indent the output xml. |
void |
setNamespaceDeclarationEnabled(boolean enabled)
Enable declaration of namespace prefixes in the first element. |
void |
setOmitXMLDeclaration(boolean xmlDecl)
Set this transformer to omit/include the XML declaration. |
java.lang.String |
transform(java.lang.Object object)
Perform the XML encoding of the given object into an internal buffer and return the resulting String. |
void |
transform(java.lang.Object object,
java.io.OutputStream out)
Perform the XML encoding on the given object to the given OutputStream. |
void |
transform(java.lang.Object object,
javax.xml.transform.stream.StreamResult result)
Perform the XML encoding on the given object to the given OutputStream. |
void |
transform(java.lang.Object object,
java.io.Writer out)
Perform the XML encoding on the given object to the given Writer. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public TransformerBase()
Method Detail |
public abstract Translator createTranslator(org.xml.sax.ContentHandler handler)
public javax.xml.transform.Transformer createTransformer() throws javax.xml.transform.TransformerException
javax.xml.transform.TransformerException
public void transform(java.lang.Object object, java.io.OutputStream out) throws javax.xml.transform.TransformerException
javax.xml.transform.TransformerException
public void transform(java.lang.Object object, java.io.Writer out) throws javax.xml.transform.TransformerException
javax.xml.transform.TransformerException
public void transform(java.lang.Object object, javax.xml.transform.stream.StreamResult result) throws javax.xml.transform.TransformerException
javax.xml.transform.TransformerException
public TransformerBase.Task createTransformTask(java.lang.Object object, javax.xml.transform.stream.StreamResult result) throws javax.xml.transform.TransformerException
javax.xml.transform.TransformerException
public java.lang.String transform(java.lang.Object object) throws javax.xml.transform.TransformerException
javax.xml.transform.TransformerException
public TransformerBase.XMLReaderSupport createXMLReader(java.lang.Object object)
public int getIndentation()
public void setIndentation(int amt)
amt
- The number of spaces to indent if > 0, otherwise disable.public java.nio.charset.Charset getEncoding()
public void setEncoding(java.nio.charset.Charset charset)
charset
- A charset object of the desired encodingpublic boolean isOmitXMLDeclaration()
public void setOmitXMLDeclaration(boolean xmlDecl)
xmlDecl
- Omit/include the XML declaration.public boolean isNamespaceDeclartionEnabled()
public void setNamespaceDeclarationEnabled(boolean enabled)
enabled
- Enable namespace declaration.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |