#include <DDXParser.h>
Collaboration diagram for DDXParser:
Public Member Functions | |
DDXParser (BaseTypeFactory *factory) | |
void | intern (const string &document, DDS *dest_dds, string *blob) |
void | intern_stream (FILE *in, DDS *dds, string *blob) |
Read the DDX from a stream instead of a file. | |
Static Public Member Functions | |
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 | characters (DDXParser *parser, const xmlChar *ch, int len) |
void | ddx_end_document (DDXParser *parser) |
void | ddx_end_element (DDXParser *parser, const char *name) |
void | ddx_fatal_error (DDXParser *parser, const char *msg,...) |
xmlEntityPtr | ddx_get_entity (DDXParser *parser, const xmlChar *name) |
void | ddx_start_document (DDXParser *parser) |
void | ddx_start_element (DDXParser *parser, const char *name, const char **attrs) |
This parser for the DDX 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 DDXParser object. Once the error handler is called, construction of an DDX/DDS 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 DDXParseFailed 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 DDXParser.h.
|
Definition at line 170 of file DDXParser.h. |
|
Process/accumulate character data. This may be called more than once for one logical clump of data. Only save character data when processing 'value' elements; throw away all other characters. Definition at line 823 of file DDXParser.cc. References char_data, DBG2, and get_state(). |
Here is the call graph for this function:
|
Clean up after finishing a parse.
Definition at line 482 of file DDXParser.cc. References DDS::add_var(), bt_stack, DBG2, dds, ddx_fatal_error(), get_state(), Constructor::var_begin(), and Constructor::var_end(). |
Here is the call graph for this function:
|
Process an end element tag. This is where values are added to the DDS/DDX or their parent BaseType.
Definition at line 686 of file DDXParser.cc. References BaseType::add_var(), AttrTable::append_attr(), at_stack, bt_stack, char_data, DBG2, ddx_fatal_error(), dods_array_c, dods_attr_name, dods_attr_type, dods_grid_c, dods_sequence_c, dods_structure_c, finish_variable(), get_state(), BaseType::is_constructor_type(), BaseType::is_vector_type(), and pop_state(). |
Here is the call graph for this function:
|
Process an XML fatal error. Note that SAX provides for warnings, errors and fatal errors. This code treats them all as fatal errors since there's typically no way to tell a user about the error since there's often no user interface for this software.
Definition at line 852 of file DDXParser.cc. References ctxt, error_msg, long_to_string(), and set_state(). Referenced by ddx_end_document(), ddx_end_element(), and ddx_start_element(). |
Here is the call graph for this function:
|
Handle the standard XML entities.
Definition at line 840 of file DDXParser.cc. |
|
Initialize the SAX parser state object. This object is passed to each callback as a void pointer. The initial state is parser_start.
Definition at line 462 of file DDXParser.cc. References at_stack, bt_stack, char_data, DBG2, dds, error_msg, DDS::get_attr_table(), get_state(), and set_state(). |
Here is the call graph for this function:
|
Process a start element tag. Because the DDX schema uses attributes and because libxml2 does not validate those, we do attribute validation here.
Definition at line 514 of file DDXParser.cc. References attributes, check_required_attribute(), DBG2, DBGN, dds, ddx_fatal_error(), dods_array_c, get_state(), is_attribute_or_alias(), is_variable(), process_blob(), process_dimension(), process_variable(), DDS::set_dataset_name(), set_state(), and transfer_attrs(). |
Here is the call graph for this function:
|
Parse a DDX document stored in a file. The XML in the doucument is parsed and a binary DDX is built. This implementation stores the result in a DDS object where each instance of BaseType can hold an AttrTable object.
Definition at line 995 of file DDXParser.cc. |
|
Definition at line 948 of file DDXParser.cc. |