| |
|
| java.lang.Object fr.dyade.koala.xml.kbml.KBMLSerializer
All known Subclasses: fr.dyade.koala.xml.kbml.KBMLSerializerDefaultErrorHandler,
KBMLSerializer | public class KBMLSerializer (Code) | | The class enables to create an XML document from JavaBeans.
Any number of beans can be written. In order to have a valid XML
document, the beans must be enclosed by the KBML tag. Here is an
exemple to write 2 beans:
KBMLSerializer bxo = new KBMLSerializer(new FileOutputStream("test.kbml"));
bxo.writeXMLDeclaration();
bxo.writeDocumentTypeDefinition();
bxo.writeKBMLStartTag();
bxo.writeBean(bean1);
bxo.writeBean(bean2);
bxo.writeKBMLEndTag();
bxo.flush();
bxo.close();
author: Thierry.Kormann@sophia.inria.fr |
Inner Class :public interface ErrorHandler | |
Constructor Summary | |
public | KBMLSerializer(OutputStream ostream) Constructs a new serializer with the specified output stream. | public | KBMLSerializer(OutputStream ostream, ErrorHandler handler) Constructs a new serializer with the specified output stream
and error handler. | public | KBMLSerializer(Writer writer) Constructs a new serializer with the specified writer. | public | KBMLSerializer(Writer writer, ErrorHandler handler) Constructs a new serializer with the specified writer
and error handler. |
COPYRIGHT | final static String COPYRIGHT(Code) | | The KBML copyright.
|
ID_PREFIX | static String ID_PREFIX(Code) | | The prefix used to generate id
|
START_ROOT_ELEMENT | final static String START_ROOT_ELEMENT(Code) | | |
VERSION | final public static String VERSION(Code) | | The KBML version.
|
WRITE_DEFAULT_VALUES | final public static int WRITE_DEFAULT_VALUES(Code) | | This flag bit indicates that the default values must be written.
|
beansCache | protected Hashtable beansCache(Code) | | The Hashtable where keys are Object and values are ID.
|
handler | protected ErrorHandler handler(Code) | | The error handler used to notify no-fatal errors.
|
ostream | protected OutputStream ostream(Code) | | The underlying output stream used to store the beans.
|
serializationOptions | protected int serializationOptions(Code) | | The options used by this serializer.
|
writer | protected Writer writer(Code) | | The underlying writer used to store the beans.
|
KBMLSerializer | public KBMLSerializer(OutputStream ostream)(Code) | | Constructs a new serializer with the specified output stream.
Parameters: ostream - the underlying output stream, to be saved for later use |
KBMLSerializer | public KBMLSerializer(OutputStream ostream, ErrorHandler handler)(Code) | | Constructs a new serializer with the specified output stream
and error handler.
Parameters: ostream - the underlying output stream, to be saved for later use Parameters: handler - the handler to track the no-fatal error |
KBMLSerializer | public KBMLSerializer(Writer writer)(Code) | | Constructs a new serializer with the specified writer.
Parameters: writer - the underlying writer, to be saved for later use |
KBMLSerializer | public KBMLSerializer(Writer writer, ErrorHandler handler)(Code) | | Constructs a new serializer with the specified writer
and error handler.
Parameters: writer - the underlying writer, to be saved for later use Parameters: handler - the handler to track the no-fatal error |
getBeanClassName | protected String getBeanClassName(Object bean)(Code) | | Returns the class attribute that will be written in the XML
document for the given bean. Override to let custom a class
loader returns a coded class name (like an URL).
Parameters: bean - the bean the string representation of the specified bean class since: KBML 2.2 |
getBeansCache | public Hashtable getBeansCache()(Code) | | Returns the internal cache used by the serializer. Use the
bean as a key to get its associated ID.
|
setSerializationOptions | public void setSerializationOptions(int serializationOptions)(Code) | | Enables or disables options that can modify the way this
serializer writes beans, properties and values.
Parameters: serializationOptions - determines how this serializer willwrite beans, properties or values See Also: KBMLSerializer.WRITE_DEFAULT_VALUES since: KBML 2.3 |
writeComment | public void writeComment(String comment) throws IOException(Code) | | Writes a comment.
Parameters: comment - The comment string. Special characters will be quoted. exception: IOException - if an I/O error occurs |
writeDocumentTypeDefinition | public void writeDocumentTypeDefinition() throws IOException(Code) | | Writes the default document type definition. The DTD used is
the one located at http://www.inria.fr/koala/kbml/kbml20.dtd
exception: IOException - if an I/O error occurs since: KBML 2.2 |
writeDocumentTypeDefinition | public void writeDocumentTypeDefinition(String doctype) throws IOException(Code) | | Writes the specified document type definition.
Parameters: doctype - the document type definition to write exception: IOException - if an I/O error occurs since: KBML 2.2 |
writeKBMLEndTag | public void writeKBMLEndTag() throws IOException(Code) | | Writes the KBML end tag.
exception: IOException - if an I/O error occurs exception: IllegalStateException - if KBML start tag was notwritten, or KBML end tag was already written. |
writeXMLDeclaration | public void writeXMLDeclaration() throws IOException(Code) | | Writes the XML declaration. The declaration is
<?xml version='1.0' encoding='UTF-8'?>
exception: IOException - if an I/O error occurs since: KBML 2.2 |
|
|
|