libdap Updated for version 3.21.1
libdap4 is an implementation of OPeNDAP's DAP protocol.
|
#include <AISDatabaseParser.h>
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. | |
void | intern (const string &database, AISResources *ais) |
static void | aisStartDocument (AISParserState *state) |
static void | aisEndDocument (AISParserState *state) |
static void | aisStartElement (AISParserState *state, const char *name, const char **attrs) |
static void | aisEndElement (AISParserState *state, const char *name) |
static xmlEntityPtr | aisGetEntity (AISParserState *state, const xmlChar *name) |
static void | aisWarning (AISParserState *state, const char *msg,...) |
static void | aisError (AISParserState *state, const char *msg,...) |
static void | aisFatalError (AISParserState *state, const char *msg,...) |
Parse the XML database/configuration file which lists a collection of AIS resources.
Static methods are used as callbacks for the SAX parser. They do not throw exceptions because exceptions from within callbacks are not reliable or portable. To signal errors, the methods record information in the AISParserState object. Once any of the error handlers (aisWarning, aisError or aisFatalError) is called, construction of an AISResources object ends even though the SAX parser still calls the various callback functions. The parse method throws an AISDatabaseReadFailed 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.
This class should be extended so that the line number is added to error messages.
Definition at line 68 of file AISDatabaseParser.h.
|
static |
Clean up after finishing a parse.
state | The SAX parser state. |
Definition at line 62 of file AISDatabaseParser.cc.
|
static |
Process an end element tag. This is where values are added to the AISResources object that's held by state
.
state | The SAX parser state. |
name | The name of the element; used only for code instrumentation. |
Definition at line 181 of file AISDatabaseParser.cc.
|
static |
Process an XML error. This is treated as a fatal error since there's no easy way for libdap++ to signal a warning to users.
state | The SAX parser state. |
msg | A printf-style format string. |
Definition at line 262 of file AISDatabaseParser.cc.
|
static |
Process an XML fatal error.
state | The SAX parser state. |
msg | A printf-style format string. |
Definition at line 285 of file AISDatabaseParser.cc.
|
static |
Handle the standard XML entities.
state | The SAX parser state. |
name | The XML entity. |
Definition at line 230 of file AISDatabaseParser.cc.
|
static |
Initialize the SAX parser state object. This object is passed to each callback as a void pointer.
state | The SAX parser state. |
Definition at line 51 of file AISDatabaseParser.cc.
|
static |
Process a start element tag. Because the AIS DTD uses attributes and because libxml2 does not validate those, we do attribute validation here. Values pulled from the attributes are recorded in state
for later use in aisEndElement.
state | The SAX parser state. |
name | The name of the element. |
attrs | The element's attributes; 0, 2, 4, ... are the attribute names, 1, 3, 5, ... are the values. |
Definition at line 80 of file AISDatabaseParser.cc.
|
static |
Process an XML warning. This is treated as a fatal error since there's no easy way for libdap++ to signal a warning to users.
state | The SAX parser state. |
msg | A printf-style format string. |
Definition at line 238 of file AISDatabaseParser.cc.
void libdap::AISDatabaseParser::intern | ( | const string & | database, |
AISResources * | ais ) |
Parse an AIS database encoded in XML. The information in the XML document is loaded into an instance of AISResources.
database | Read from this XML file. |
ais | Load information into this instance of AISResources. |
AISDatabaseReadFailed | Thrown if the XML document could not be read or parsed. |
Definition at line 354 of file AISDatabaseParser.cc.