![]() |
The Simons
|
#include <XMLReader.h>
Inheritance diagram for XMLReader:
The XMLReader class is a kind of Reader that reconstructs Objects that were previously serialised in the XML-format generated by XMLWriter. XMLReader provides get() to reconstruct a root Object and all Objects reachable from it; and getField() to reconstruct a branch Object stored as the named field of some other Object. The get() method is used by client programs to reconstruct a graph of Objects at the top level; while getField() should be called within the readOn() method defined for every kind of Object, to reconstruct each of its fields.
Public Member Functions | |
XMLReader () | |
Construct a standard XMLReader stream. | |
virtual | ~XMLReader () |
Release an unused XMLReader stream. | |
virtual ObjectID | clone () const |
Clone a copy of this XMLReader. | |
XMLReader (StringID) | |
Construct a file XMLReader stream. | |
virtual ReaderID | get (ObjectID &) |
Read in an Object from its XML-encoded, textual representation. | |
virtual ReaderID | getField (StringID, ObjectID &) |
Read in the Object named by this field from its XML-encoded textual representation. | |
virtual Natural | multiple () const |
Return the field multiple. |
|
Construct a standard XMLReader stream. Constructs an XMLReader whose input is the standard TextInput stream, initially closed.
|
|
Release an unused XMLReader stream. Performs all closing actions to disconnect from the underlying filesystem. |
|
Construct a file XMLReader stream. Constructs an XMLReader stream whose input is the TextInput stream named by the file path name.
|
|
Clone a copy of this XMLReader. Creates a shallow copy, which shares the file path name, if any, but does not initialise any filesystem. Reimplemented from Object. |
|
Read in an Object from its XML-encoded, textual representation. This is the top-level method for reconstructing an Object cluster. The argument variable will be initialised with an Object and all of its connected dependents, as this XMLReader decodes the serialized textual representation, which was previously encoded using an XMLWriter stream. This method reads the XML header then calls getField("root", variable) to reconstruct the Object cluster. A ReadFailure exception may be raised if reading fails.
Reimplemented from Reader. |
|
Read in the Object named by this field from its XML-encoded textual representation. The opening tag is decoded. If this is a self-closing tag, the Object has been encountered before and so the identity attribute is used to fetch the same Object. Otherwise, the tag name is used to create a blank Object of the named Type, whose field data is recovered, after which a closing tag is expected. If the opening tag also has a size attribute, the Object is a Collection with the given number of elements. Field data is reconstructed by invoking readOn(this) on the blank Object. This calls getField() recursively for each of the Object's fields. A Collection may invoke multiple() on this XMLReader to determine the number of fields to reconstruct.
Reimplemented from Reader. |
|
Return the field multiple. Attribute fields have a multiple of one. The element field of a Collection has a variable multiple, ranging from zero to many. This method is used by Collection in readOn() to determine how many element fields to expect.
Reimplemented from Reader. |