libdap Updated for version 3.21.1
libdap4 is an implementation of OPeNDAP's DAP protocol.
The 'strict' mode

Functions

void libdap::D4ParserSax2::XMLAttribute::clone (const XMLAttribute &src)
 
XMLAttributelibdap::D4ParserSax2::XMLAttribute::operator= (const XMLAttribute &rhs)
 
 libdap::D4ParserSax2::XMLAttribute::XMLAttribute ()
 
 libdap::D4ParserSax2::XMLAttribute::XMLAttribute (const string &p, const string &ns, const string &v)
 
 libdap::D4ParserSax2::XMLAttribute::XMLAttribute (const XMLAttribute &rhs)
 
 libdap::D4ParserSax2::XMLAttribute::XMLAttribute (const xmlChar **attributes)
 
 libdap::D4ParserSax2::XMLAttribute::~XMLAttribute ()
 

Variables

string libdap::D4ParserSax2::XMLAttribute::nsURI
 
string libdap::D4ParserSax2::XMLAttribute::prefix
 
string libdap::D4ParserSax2::XMLAttribute::value
 

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.

void libdap::D4ParserSax2::set_strict (bool s)
 Set the 'strict' mode to true or false.
 
bool libdap::D4ParserSax2::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 libdap::D4ParserSax2::dmr_start_document (void *parser)
 
static void libdap::D4ParserSax2::dmr_end_document (void *parser)
 
static void libdap::D4ParserSax2::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 libdap::D4ParserSax2::dmr_end_element (void *parser, const xmlChar *localname, const xmlChar *prefix, const xmlChar *URI)
 
static void libdap::D4ParserSax2::dmr_get_characters (void *parser, const xmlChar *ch, int len)
 
static void libdap::D4ParserSax2::dmr_ignoreable_whitespace (void *parser, const xmlChar *ch, int len)
 
static void libdap::D4ParserSax2::dmr_get_cdata (void *parser, const xmlChar *value, int len)
 
static xmlEntityPtr libdap::D4ParserSax2::dmr_get_entity (void *parser, const xmlChar *name)
 
static void libdap::D4ParserSax2::dmr_fatal_error (void *parser, const char *msg,...)
 
static void libdap::D4ParserSax2::dmr_error (void *parser, const char *msg,...)
 

Detailed Description

The strict mode of the parser is the default. In this mode any error will result in an exception and parsing will stop. When strict mode is set to false (forgiving mode?), some errors will be silently ignored. The list of allowed errors is: The Array named by a Map element is not required to be in the DMR. There are no other allowed errors at this time (4/13/16)

Function Documentation

◆ clone()

void libdap::D4ParserSax2::XMLAttribute::clone ( const XMLAttribute & src)
inline

Definition at line 189 of file D4ParserSax2.h.

◆ dmr_end_document()

void libdap::D4ParserSax2::dmr_end_document ( void * p)
static

Clean up after finishing a parse.

Parameters
pThe SAX parser

Definition at line 577 of file D4ParserSax2.cc.

◆ dmr_end_element()

void libdap::D4ParserSax2::dmr_end_element ( void * parser,
const xmlChar * localname,
const xmlChar * prefix,
const xmlChar * URI )
static

Definition at line 839 of file D4ParserSax2.cc.

◆ dmr_error()

void libdap::D4ParserSax2::dmr_error ( void * parser,
const char * msg,
... )
static

Definition at line 1185 of file D4ParserSax2.cc.

◆ dmr_fatal_error()

void libdap::D4ParserSax2::dmr_fatal_error ( void * p,
const char * msg,
... )
static

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.

Note
This static function does not throw an exception or otherwise alter flow of control except for altering the parser state.
Parameters
pThe SAX parser
msgA printf-style format string.

Definition at line 1167 of file D4ParserSax2.cc.

◆ dmr_get_cdata()

void libdap::D4ParserSax2::dmr_get_cdata ( void * p,
const xmlChar * value,
int len )
static

Get characters in a cdata block. DAP does not use CData, but XML in an OtherXML attribute (the value of that DAP attribute) might use it. This callback also allows CData when the parser is in the 'parser_unknown' state since some future DAP element might use it.

Definition at line 1133 of file D4ParserSax2.cc.

◆ dmr_get_characters()

void libdap::D4ParserSax2::dmr_get_characters ( void * p,
const xmlChar * ch,
int len )
static

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 1092 of file D4ParserSax2.cc.

◆ dmr_get_entity()

xmlEntityPtr libdap::D4ParserSax2::dmr_get_entity ( void * parser,
const xmlChar * name )
static

Handle the standard XML entities.

Parameters
parserThe SAX parser
nameThe XML entity.

Definition at line 1155 of file D4ParserSax2.cc.

◆ dmr_ignoreable_whitespace()

void libdap::D4ParserSax2::dmr_ignoreable_whitespace ( void * p,
const xmlChar * ch,
int len )
static

Read whitespace that's not really important for content. This is used only for the OtherXML attribute type to preserve formating of the XML. Doing so makes the attribute value far easier to read.

Definition at line 1115 of file D4ParserSax2.cc.

◆ dmr_start_document()

void libdap::D4ParserSax2::dmr_start_document ( void * p)
static

Initialize the SAX parser state object. This object is passed to each callback as a void pointer. The initial state is parser_start.

Parameters
pThe SAX parser

Definition at line 559 of file D4ParserSax2.cc.

◆ dmr_start_element()

void libdap::D4ParserSax2::dmr_start_element ( void * p,
const xmlChar * l,
const xmlChar * prefix,
const xmlChar * URI,
int nb_namespaces,
const xmlChar ** namespaces,
int nb_attributes,
int nb_defaulted,
const xmlChar ** attributes )
static

Callback run when libxml2 reads the start of an element

Parameters
pPointer to the parser object
lLocalname of the element
prefixNamespace prefix of the element
URIthe Element namespace name if available
nb_namespacesNumber of namespace definitions on that node
namespacesPointer to the array of prefix/URI pairs namespace definitions
nb_attributesThe number of attributes on that node
nb_defaultedThe number of defaulted attributes. The defaulted ones are at the end of the array
attributesPointer to the array of (localname/prefix/URI/value/end) attribute values.

Definition at line 612 of file D4ParserSax2.cc.

◆ get_strict()

bool libdap::D4ParserSax2::get_strict ( ) const
inline

Get the setting of the 'strict' mode.

Returns
True or False.

Definition at line 297 of file D4ParserSax2.h.

◆ operator=()

XMLAttribute & libdap::D4ParserSax2::XMLAttribute::operator= ( const XMLAttribute & rhs)
inline

Definition at line 206 of file D4ParserSax2.h.

◆ set_strict()

void libdap::D4ParserSax2::set_strict ( bool s)
inline

Set the 'strict' mode to true or false.

Definition at line 293 of file D4ParserSax2.h.

◆ XMLAttribute() [1/4]

libdap::D4ParserSax2::XMLAttribute::XMLAttribute ( )
inline

Definition at line 195 of file D4ParserSax2.h.

◆ XMLAttribute() [2/4]

libdap::D4ParserSax2::XMLAttribute::XMLAttribute ( const string & p,
const string & ns,
const string & v )
inline

Definition at line 196 of file D4ParserSax2.h.

◆ XMLAttribute() [3/4]

libdap::D4ParserSax2::XMLAttribute::XMLAttribute ( const XMLAttribute & rhs)
inline

Definition at line 204 of file D4ParserSax2.h.

◆ XMLAttribute() [4/4]

libdap::D4ParserSax2::XMLAttribute::XMLAttribute ( const xmlChar ** attributes)
inline

Definition at line 199 of file D4ParserSax2.h.

◆ ~XMLAttribute()

libdap::D4ParserSax2::XMLAttribute::~XMLAttribute ( )
inline

Definition at line 205 of file D4ParserSax2.h.

Variable Documentation

◆ nsURI

string libdap::D4ParserSax2::XMLAttribute::nsURI

Definition at line 186 of file D4ParserSax2.h.

◆ prefix

string libdap::D4ParserSax2::XMLAttribute::prefix

Definition at line 185 of file D4ParserSax2.h.

◆ value

string libdap::D4ParserSax2::XMLAttribute::value

Definition at line 187 of file D4ParserSax2.h.