30 #ifndef __NCML_MODULE_NCML_PARSER_H__
31 #define __NCML_MODULE_NCML_PARSER_H__
40 #include <AttrTable.h>
68 class AggregationElement;
69 class DimensionElement;
145 AttrTable*
get()
const;
148 void set(AttrTable* pAT);
157 void loadAndSetAttrTable();
160 mutable AttrTable* _pAttrTable;
161 mutable bool _loaded;
223 bool parsing()
const;
226 int getParseLineNumber()
const;
234 virtual void onStartDocument();
235 virtual void onEndDocument();
236 virtual void onStartElement(
const std::string& name,
const XMLAttributeMap& attrs);
237 virtual void onEndElement(
const std::string& name);
239 virtual void onStartElementWithNamespace(
240 const std::string& localname ,
241 const std::string& prefix,
242 const std::string& uri,
246 virtual void onEndElementWithNamespace(
247 const std::string& localname,
248 const std::string& prefix,
249 const std::string& uri);
251 virtual void onCharacters(
const std::string& content);
252 virtual void onParseWarning(std::string msg);
253 virtual void onParseError(std::string msg);
254 virtual void setParseLineNumber(
int line);
262 bool isScopeAtomicAttribute()
const;
265 bool isScopeAttributeContainer()
const;
268 bool isScopeSimpleVariable()
const;
271 bool isScopeCompositeVariable()
const;
274 bool isScopeVariable()
const;
277 bool isScopeGlobal()
const;
280 bool isScopeNetcdf()
const;
283 bool isScopeAggregation()
const;
288 bool withinNetcdf()
const;
294 bool withinVariable()
const;
322 DDS* getDDSForCurrentDataset()
const;
340 void addChildDatasetToCurrentDataset(
NetcdfElement* dataset);
353 bool parsingDataRequest()
const;
358 void resetParseState();
366 bool isNameAlreadyUsedAtCurrentScope(
const std::string& name);
375 BaseType* getVariableInCurrentVariableContainer(
const string& name);
384 BaseType* getVariableInContainer(
const string& varName, BaseType* pContainer);
393 BaseType* getVariableInDDS(
const string& varName);
409 void addCopyOfVariableAtCurrentScope(BaseType& varTemplate);
415 void deleteVariableAtCurrentScope(
const string& name);
420 BaseType* getCurrentVariable()
const;
426 void setCurrentVariable(BaseType* pVar);
434 static bool typeCheckDAPVariable(
const BaseType& var,
const string& expectedType);
444 AttrTable* getCurrentAttrTable()
const;
451 void setCurrentAttrTable(AttrTable* pAT);
457 AttrTable* getGlobalAttrTable()
const;
463 bool attributeExistsAtCurrentScope(
const string& name)
const;
470 bool findAttribute(
const string& name, AttrTable::Attr_iter& attr)
const;
475 void clearAllAttrTables(DDS* dds);
478 void clearVariableMetadataRecursively(BaseType* var);
485 int tokenizeAttrValues(vector<string>& tokens,
const string& values,
const string& dapAttrTypeName,
const string& separator);
495 int tokenizeValuesForDAPType(vector<string>& tokens,
const string& values, AttrType dapType,
const string& separator);
504 void printScope()
const;
507 string getScopeString()
const;
510 string getTypedScopeString()
const;
513 int getScopeDepth()
const;
529 typedef std::vector<NCMLElement*>::const_reverse_iterator ElementStackConstIterator;
530 ElementStackConstIterator getElementStackBegin()
const {
return _elementStack.rbegin(); }
531 ElementStackConstIterator getElementStackEnd()
const {
return _elementStack.rend(); }
536 void clearElementStack();
539 void processStartNCMLElement(
const std::string& name,
const XMLAttributeMap& attrs);
542 void processEndNCMLElement(
const std::string& name);
547 const DimensionElement* getDimensionAtLexicalScope(
const string& dimName)
const;
553 string printAllDimensionsAtLexicalScope()
const;
568 void enterOtherXMLParsingState(OtherXMLParser* pOtherXMLParser);
569 bool isParsingOtherXML()
const;
591 static string convertNcmlTypeToCanonicalType(
const string& ncmlType);
600 void checkDataIsValidForCanonicalTypeOrThrow(
const string& type,
const vector<string>& tokens)
const;
607 static bool sThrowExceptionOnUnknownElements;
645 std::vector<NCMLElement*> _elementStack;
663 int _currentParseLine;
ResponseType
For telling the loader what type of BESDapResponse to load and return.
Factory class for the NcML elements.
Represents an OPeNDAP DDS DAP2 data object within the BES.
An abstract superclass for NCMLArray that handles the non-parameterized functionality and allows u...
Helper class for temporarily hijacking an existing dhi to load a DDX response for one particular file...
Concrete class for NcML element.
Implementation of the element used to scan directories to create the set of files for an aggre...
Concrete subclass for the NcML element.
static class NCMLUtil overview
ScopeType
The current scope is either global attribute table, within a variable's attribute table...
static const string STRUCTURE_TYPE
The string describing the type "Structure".
Class used to handle parsing in an attribute of type=="OtherXML" which basically just has to keep app...
Represents an OPeNDAP DataDDS DAP2 data object within the BES.
Base class for NcML element concrete classes.
Represents an OPeNDAP DAP response object within the BES.
Concrete class for NcML element.
Concrete class for NcML element.
Concrete class for NcML
element.
Element for the
element child of an .
Interface class for the wrapper between libxml C SAX parser and our NCMLParser.