libdap Updated for version 3.21.1
libdap4 is an implementation of OPeNDAP's DAP protocol.
|
#include <D4ParserSax2.h>
Parser Actions | |
These methods are the 'actions' carried out by the start_element and end_element callbacks. Most of what takes place in those has been factored out to this set of functions. | |
class | D4ParserSax2Test |
D4ParserSax2 () | |
void | intern (istream &f, DMR *dest_dmr, bool debug=false) |
void | intern (const string &document, DMR *dest_dmr, bool debug=false) |
void | intern (const char *buffer, int size, DMR *dest_dmr, bool debug=false) |
void | set_strict (bool s) |
Set the 'strict' mode to true or false. | |
bool | get_strict () const |
Get the setting of the 'strict' mode. | |
SAX Parser Callbacks | |
These methods are declared static in the class header. This gives them C linkage which allows them to be used as callbacks by the SAX parser engine. | |
static void | dmr_start_document (void *parser) |
static void | dmr_end_document (void *parser) |
static void | dmr_start_element (void *parser, const xmlChar *localname, const xmlChar *prefix, const xmlChar *URI, int nb_namespaces, const xmlChar **namespaces, int nb_attributes, int nb_defaulted, const xmlChar **attributes) |
static void | dmr_end_element (void *parser, const xmlChar *localname, const xmlChar *prefix, const xmlChar *URI) |
static void | dmr_get_characters (void *parser, const xmlChar *ch, int len) |
static void | dmr_ignoreable_whitespace (void *parser, const xmlChar *ch, int len) |
static void | dmr_get_cdata (void *parser, const xmlChar *value, int len) |
static xmlEntityPtr | dmr_get_entity (void *parser, const xmlChar *name) |
static void | dmr_fatal_error (void *parser, const char *msg,...) |
static void | dmr_error (void *parser, const char *msg,...) |
Parse the XML text which encodes the network/persistent representation of the DMR object. In the current implementation, the DMR is held by an instance of the class DDS which in turn holds variables which include attributes.
This parser for the DMR document uses the SAX interface of libxml2. Static methods are used as callbacks for the SAX parser. These static methods are public because making them private complicates compilation. They should not be called by anything other than the intern method. They do not throw exceptions because exceptions from within callbacks are not reliable or portable. To signal errors, the methods record information in the D4ParserSax2 object. Once the error handler is called, construction of an DMR object ends even though the SAX parser still calls the various callback functions. The parser treats warnings, errors and fatal_errors the same way; when any are found parsing stops. The intern method throws an Error of InternalErr exception if an error was found.
Note that this class uses the C++-supplied default definitions for the default and copy constructors as well as the destructor and assignment operator.
Definition at line 76 of file D4ParserSax2.h.
|
inline |
Definition at line 255 of file D4ParserSax2.h.
void libdap::D4ParserSax2::intern | ( | const char * | buffer, |
int | size, | ||
DMR * | dest_dmr, | ||
bool | debug = false ) |
Parse a DMR document stored in a char *buffer.
document | Read the DMR from this string. |
dest_dmr | Value/result parameter; dumps the information to this DMR instance. |
debug | If true, ouput helpful debugging messages, False by default |
Error | Thrown if the XML document could not be read or parsed. |
InternalErr | Thrown if an internal error is found. |
Definition at line 1371 of file D4ParserSax2.cc.
Parse a DMR document stored in a string.
document | Read the DMR from this string. |
dest_dmr | Value/result parameter; dumps the information to this DMR instance. |
debug | If true, output helpful debugging messages, False by default |
Error | Thrown if the XML document could not be read or parsed. |
InternalErr | Thrown if an internal error is found. |
Definition at line 1357 of file D4ParserSax2.cc.
Read the DMR from a stream.
f | The input stream |
dest_dmr | Value-result parameter. Pass a pointer to a DMR in and the information in the DMR will be added to it. |
boundary | If not empty, use this as the boundary tag in a MPM document that marks the end of the part hat holds the DMR. Stop reading when the boundary is found. |
debug | If true, ouput helpful debugging messages, False by default. |
Error | Thrown if the XML document could not be read or parsed. |
InternalErr | Thrown if an internal error is found. |
Definition at line 1251 of file D4ParserSax2.cc.
|
friend |
Definition at line 252 of file D4ParserSax2.h.