|
OPeNDAP Hyrax Back End Server (BES)
Updated for version 3.8.3
|
#include <NCMLParser.h>


Public Member Functions | |
| void | checkDataIsValidForCanonicalTypeOrThrow (const string &type, const vector< string > &tokens) const |
| Make sure the given tokens are valid for the listed type. More... | |
| int | getParseLineNumber () const |
| Get the line of the NCML file the parser is currently parsing. More... | |
| const XMLNamespaceStack & | getXMLNamespaceStack () const |
| If using namespaces, get the current stack of namespaces. More... | |
| NCMLParser (agg_util::DDSLoader &loader) | |
| Create a structure that can parse an NCML filename and returned a transformed response of requested type. More... | |
| virtual void | onCharacters (const std::string &content) |
| Called when characters are encountered within an element. More... | |
| virtual void | onEndDocument () |
| virtual void | onEndElement (const std::string &name) |
| virtual void | onEndElementWithNamespace (const std::string &localname, const std::string &prefix, const std::string &uri) |
| SAX2 End element with namespace information. More... | |
| virtual void | onParseError (std::string msg) |
| An unrecoverable parse error occurred. More... | |
| virtual void | onParseWarning (std::string msg) |
| A recoverable parse error occured. More... | |
| virtual void | onStartDocument () |
| virtual void | onStartElement (const std::string &name, const XMLAttributeMap &attrs) |
| virtual void | onStartElementWithNamespace (const std::string &localname, const std::string &prefix, const std::string &uri, const XMLAttributeMap &attributes, const XMLNamespaceMap &namespaces) |
| SAX2 start element call with gets namespace information. More... | |
| auto_ptr< BESDapResponse > | parse (const string &ncmlFilename, agg_util::DDSLoader::ResponseType type) |
| Parse the NcML filename, returning a newly allocated DDS response containing the underlying dataset transformed by the NcML. More... | |
| void | parseInto (const string &ncmlFilename, agg_util::DDSLoader::ResponseType responseType, BESDapResponse *response) |
| Same as parse, but the response object to parse into is passed down by the caller rather than created. More... | |
| bool | parsing () const |
| Are we currently parsing? More... | |
| virtual void | setParseLineNumber (int line) |
| Before any of the callbacks are issued, this function is called to let the implementing parser know what line number in the parse the next callback is being issued from to allow for more informative error messages. More... | |
| virtual | ~NCMLParser () |
Static Public Member Functions | |
| static string | convertNcmlTypeToCanonicalType (const string &ncmlType) |
| Convert the NCML type in ncmlType into a canonical type we will use in the parser. More... | |
Static Public Attributes | |
| static const string | STRUCTURE_TYPE |
| The string describing the type "Structure". More... | |
Friends | |
| class | AggregationElement |
| class | AttributeElement |
| class | AttrTableLazyPtr |
| class | DimensionElement |
| class | ExplicitElement |
| class | NetcdfElement |
| class | ReadMetadataElement |
| class | RemoveElement |
| class | ScanElement |
| class | ValuesElement |
| class | VariableAggElement |
| class | VariableElement |
Definition at line 164 of file NCMLParser.h.
| ncml_module::NCMLParser::NCMLParser | ( | agg_util::DDSLoader & | loader | ) |
Create a structure that can parse an NCML filename and returned a transformed response of requested type.
| loader | helper for loading a location referred to in the ncml. |
Definition at line 145 of file NCMLParser.cc.
References BESDEBUG.
|
virtual |
Definition at line 163 of file NCMLParser.cc.
| void ncml_module::NCMLParser::checkDataIsValidForCanonicalTypeOrThrow | ( | const string & | type, |
| const vector< string > & | tokens | ||
| ) | const |
Make sure the given tokens are valid for the listed type.
For example, makes sure floats are well formed, UInt16 are unsigned, etc. A successful call will return normally, else we throw an exception.
| BESUserSyntaxError | on invalid values. |
Definition at line 1076 of file NCMLParser.cc.
References getParseLineNumber(), ncml_module::ScopeStack::getScopeString(), ncml_module::NCMLUtil::isAscii(), THROW_NCML_INTERNAL_ERROR, and THROW_NCML_PARSE_ERROR.

|
static |
Convert the NCML type in ncmlType into a canonical type we will use in the parser.
Specifically, we map NcML types to their closest DAP equivalent type, but we leave Structure as Structure since it is assumed to mean Constructor for DAP which is a superclass type. Note this passes DAP types through unchanged as well. It is illegal for ncmlType to be empty(). We return "" to indicate an error in conversion.
| ncmlType | a non empty() string that could be an NcML type (or built-in DAP type) |
Definition at line 1058 of file NCMLParser.cc.
References NCML_ASSERT_MSG.
| int ncml_module::NCMLParser::getParseLineNumber | ( | ) | const |
Get the line of the NCML file the parser is currently parsing.
Definition at line 222 of file NCMLParser.cc.
Referenced by ncml_module::AggregationElement::addAggregationVariable(), checkDataIsValidForCanonicalTypeOrThrow(), ncml_module::ExplicitElement::handleBegin(), ncml_module::ReadMetadataElement::handleBegin(), ncml_module::VariableAggElement::handleBegin(), ncml_module::ValuesElement::handleBegin(), ncml_module::DimensionElement::handleBegin(), ncml_module::NetcdfElement::handleBegin(), ncml_module::AggregationElement::handleBegin(), ncml_module::RemoveElement::handleContent(), ncml_module::ExplicitElement::handleContent(), ncml_module::ReadMetadataElement::handleContent(), ncml_module::ValuesElement::handleContent(), ncml_module::AttributeElement::handleContent(), ncml_module::DimensionElement::handleContent(), ncml_module::VariableElement::handleContent(), ncml_module::NetcdfElement::handleContent(), ncml_module::AggregationElement::handleContent(), ncml_module::NCMLElement::handleContent(), ncml_module::ValuesElement::handleEnd(), ncml_module::NetcdfElement::handleEnd(), ncml_module::AggregationElement::handleEnd(), ncml_module::NCMLElement::line(), onParseError(), ncml_module::ValuesElement::setAttributes(), and ncml_module::NCMLElement::validateAttributes().
| const XMLNamespaceStack & ncml_module::NCMLParser::getXMLNamespaceStack | ( | ) | const |
If using namespaces, get the current stack of namespaces.
Might be empty.
Definition at line 228 of file NCMLParser.cc.
Referenced by ncml_module::OtherXMLParser::onStartElementWithNamespace().
|
virtual |
Called when characters are encountered within an element.
content is only valid for the call duration. Note: this will return all whitespace in the document as well, which makes it messy to use.
Implements ncml_module::SaxParser.
Definition at line 378 of file NCMLParser.cc.
References ncml_module::NCMLElement::handleContent(), ncml_module::OtherXMLParser::onCharacters(), and VALID_PTR.

|
virtual |
Implements ncml_module::SaxParser.
Definition at line 240 of file NCMLParser.cc.
References BESDEBUG.
|
virtual |
Implements ncml_module::SaxParser.
Definition at line 282 of file NCMLParser.cc.
References ncml_module::OtherXMLParser::onEndElement(), and VALID_PTR.

|
virtual |
SAX2 End element with namespace information.
| localname | the localname of the element |
| prefix | the namespace prefix or "" on the element |
| uri | the uri (or "") associated with the namespace of the element. |
Implements ncml_module::SaxParser.
Definition at line 341 of file NCMLParser.cc.
References ncml_module::OtherXMLParser::onEndElementWithNamespace(), ncml_module::XMLNamespaceStack::pop(), and VALID_PTR.

|
virtual |
An unrecoverable parse error occurred.
Implements ncml_module::SaxParser.
Definition at line 405 of file NCMLParser.cc.
References getParseLineNumber(), and THROW_NCML_PARSE_ERROR.

|
virtual |
A recoverable parse error occured.
Implements ncml_module::SaxParser.
Definition at line 398 of file NCMLParser.cc.
References BESDEBUG.
|
virtual |
Implements ncml_module::SaxParser.
Definition at line 234 of file NCMLParser.cc.
References BESDEBUG.
|
virtual |
| name | name of the element |
| attrs | a map of any attributes -> values. Volatile for this call. |
Implements ncml_module::SaxParser.
Definition at line 246 of file NCMLParser.cc.
References ncml_module::OtherXMLParser::onStartElement(), and VALID_PTR.

|
virtual |
SAX2 start element call with gets namespace information.
| localname | the localname of the element |
| prefix | the namespace prefix of the element, or "" if none. |
| uri | the uri for the namespace of the element. |
| attributes | table of the attributes (excluding namespace attributes prefixed with xmlns) |
| namespace | table of all the namespaces specification on this element |
Implements ncml_module::SaxParser.
Definition at line 315 of file NCMLParser.cc.
References ncml_module::OtherXMLParser::onStartElementWithNamespace(), ncml_module::XMLNamespaceStack::push(), and VALID_PTR.

| auto_ptr< BESDapResponse > ncml_module::NCMLParser::parse | ( | const string & | ncmlFilename, |
| agg_util::DDSLoader::ResponseType | type | ||
| ) |
Parse the NcML filename, returning a newly allocated DDS response containing the underlying dataset transformed by the NcML.
The caller owns the returned memory.
| BESSyntaxUserError | for parse errors such as bad XML or NcML referring to variables that do not exist. |
| BESInternalError | for assertion failures, null ptr exceptions, or logic errors. |
Definition at line 170 of file NCMLParser.cc.
References parseInto().
Referenced by ncml_module::NCMLRequestHandler::ncml_build_das(), ncml_module::NCMLRequestHandler::ncml_build_dds(), and ncml_module::NCMLRequestHandler::ncml_build_dmr().

| void ncml_module::NCMLParser::parseInto | ( | const string & | ncmlFilename, |
| agg_util::DDSLoader::ResponseType | responseType, | ||
| BESDapResponse * | response | ||
| ) |
Same as parse, but the response object to parse into is passed down by the caller rather than created.
| ncmlFilename | the ncml file to parse |
| responseType | the type of response. Must match response. |
| response | the premade response object. The caller owns this memory. |
Definition at line 184 of file NCMLParser.cc.
References BESDEBUG, NCML_ASSERT_MSG, ncml_module::SaxParserWrapper::parse(), parsing(), THROW_NCML_INTERNAL_ERROR, and VALID_PTR.
Referenced by ncml_module::NCMLRequestHandler::ncml_build_data(), and parse().

| bool ncml_module::NCMLParser::parsing | ( | ) | const |
|
virtual |
Before any of the callbacks are issued, this function is called to let the implementing parser know what line number in the parse the next callback is being issued from to allow for more informative error messages.
(Default impl is to ignore it now).
Reimplemented from ncml_module::SaxParser.
Definition at line 413 of file NCMLParser.cc.
|
friend |
Definition at line 169 of file NCMLParser.h.
|
friend |
Definition at line 171 of file NCMLParser.h.
|
friend |
Definition at line 170 of file NCMLParser.h.
|
friend |
Definition at line 172 of file NCMLParser.h.
|
friend |
Definition at line 173 of file NCMLParser.h.
|
friend |
Definition at line 174 of file NCMLParser.h.
|
friend |
Definition at line 175 of file NCMLParser.h.
|
friend |
Definition at line 176 of file NCMLParser.h.
|
friend |
Definition at line 177 of file NCMLParser.h.
|
friend |
Definition at line 178 of file NCMLParser.h.
|
friend |
Definition at line 179 of file NCMLParser.h.
|
friend |
Definition at line 180 of file NCMLParser.h.
|
static |
The string describing the type "Structure".
Definition at line 578 of file NCMLParser.h.