libdap Updated for version 3.21.1
libdap4 is an implementation of OPeNDAP's DAP protocol.
AISDatabaseParser.h
Go to the documentation of this file.
1
2// -*- mode: c++; c-basic-offset:4 -*-
3
4// This file is part of libdap, A C++ implementation of the OPeNDAP Data
5// Access Protocol.
6
7// Copyright (c) 2003 OPeNDAP, Inc.
8// Author: James Gallagher <jgallagher@opendap.org>
9//
10// This library is free software; you can redistribute it and/or
11// modify it under the terms of the GNU Lesser General Public
12// License as published by the Free Software Foundation; either
13// version 2.1 of the License, or (at your option) any later version.
14//
15// This library is distributed in the hope that it will be useful,
16// but WITHOUT ANY WARRANTY; without even the implied warranty of
17// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18// Lesser General Public License for more details.
19//
20// You should have received a copy of the GNU Lesser General Public
21// License along with this library; if not, write to the Free Software
22// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23//
24// You can contact OPeNDAP, Inc. at PO Box 112, Saunderstown, RI. 02874-0112.
25
26#ifndef ais_database_parser_h
27#define ais_database_parser_h
28
29#include <string>
30
31#include <libxml/parserInternals.h>
32
33#ifndef _internal_err_h
34#include "InternalErr.h"
35#endif
36
37#ifndef ais_exceptions_h
38#include "AISExceptions.h"
39#endif
40
41#ifndef ais_resources_h
42#include "AISResources.h"
43#endif
44
45namespace libdap {
46
69private:
72 enum ParseState { PARSER_START, PARSER_FINISH, AIS, ENTRY, PRIMARY, ANCILLARY, PARSER_UNKNOWN, PARSER_ERROR };
73
88 struct AISParserState {
89 ParseState state; // current state
90 ParseState prev_state; // previous state
91 int unknown_depth; // handle recursive unknown tags
92
93 string error_msg; // Error message(s), if any.
94
95 xmlParserCtxtPtr ctxt; // used for error msg line numbers
96 AISResources *ais; // dump info here
97
98 string primary; // current entry's primary URL/Regexp
99 bool regexp; // True if primary is a regexp
100
101 ResourceVector rv; // add ancillary entries to rv
102 };
103
104public:
105 void intern(const string &database, AISResources *ais);
106
107 static void aisStartDocument(AISParserState *state);
108 static void aisEndDocument(AISParserState *state);
109 static void aisStartElement(AISParserState *state, const char *name, const char **attrs);
110 static void aisEndElement(AISParserState *state, const char *name);
111 static xmlEntityPtr aisGetEntity(AISParserState *state, const xmlChar *name);
112 static void aisWarning(AISParserState *state, const char *msg, ...);
113 static void aisError(AISParserState *state, const char *msg, ...);
114 static void aisFatalError(AISParserState *state, const char *msg, ...);
115};
116
117} // namespace libdap
118
119#endif // ais_database_parser_h
static void aisWarning(AISParserState *state, const char *msg,...)
static void aisStartElement(AISParserState *state, const char *name, const char **attrs)
static xmlEntityPtr aisGetEntity(AISParserState *state, const xmlChar *name)
static void aisStartDocument(AISParserState *state)
void intern(const string &database, AISResources *ais)
static void aisEndElement(AISParserState *state, const char *name)
static void aisEndDocument(AISParserState *state)
static void aisFatalError(AISParserState *state, const char *msg,...)
static void aisError(AISParserState *state, const char *msg,...)
Manage AIS resources.
top level DAP object to house generic methods
Definition AISConnect.cc:30
vector< Resource > ResourceVector