![]() |
The Simons
|
#include <XMLWriter.h>
Inheritance diagram for XMLWriter:
The XMLWriter class is a kind of Writer that serialises Objects in the XML-format, such that XMLReader may later reconstruct them. XMLWriter provides put() to serialise a root Object and all Objects reachable from it; and putField() to serialise a branch Object stored as the named field of some other Object. The put() method is used by client programs to serialise a graph of Objects at the top level; while putField() should be called within the writeOn() method defined for every Object, to serialise each of its fields.
Public Member Functions | |
XMLWriter () | |
Construct a standard XMLWriter stream. | |
virtual | ~XMLWriter () |
Release an unused XMLWriter stream. | |
virtual ObjectID | clone () const |
Clone a copy of this XMLWriter. | |
XMLWriter (StringID) | |
Construct a file XMLWriter stream. | |
virtual WriterID | put (ObjectID) |
Write out an Object in an XML-encoded, textual representation. | |
virtual WriterID | putField (StringID, ObjectID) |
Write out the Object named by this field in an XML-encoded textual representation. |
|
Construct a standard XMLWriter stream. Constructs an XMLWriter whose output is the standard TextOutput stream, initially closed.
|
|
Release an unused XMLWriter stream. Performs all closing actions to disconnect from the underlying filesystem. |
|
Construct a file XMLWriter stream. Constructs an XMLWriter stream whose output is the TextOutput stream named by the file path name.
|
|
Clone a copy of this XMLWriter. Creates a shallow copy, which shares the file path name, if any, but does not initialise any filesystem. Reimplemented from Object. |
|
Write out an Object in an XML-encoded, textual representation. This is the top-level method for serializing an Object cluster. The Object and all of its connected dependents will be written to this XMLWriter stream, such that an XMLReader stream may later read in the Object and its dependents and rebuild the same connected cluster. This method writes the XML header then calls putField("root", object) to serialise the Object cluster. A WriteFailure exception may be raised if writing fails.
Reimplemented from Writer. |
|
Write out the Object named by this field in an XML-encoded textual representation. If the Object has not been encountered before, writes out a pair of opening and closing tags, surrounding the Object's field data, which is indented. Otherwise, writes out a single self-closing tag. The tag name is the Object's type name. Tag attributes include the field name and the identity. Simple Value objects have no identity. Collection objects also write a size attribute. Field data is written by invoking writeOn(this) on the Object after the opening tag. This calls putField() recursively for each of the Object's fields. Reimplemented from Writer. |