33 #include <libxml/parserInternals.h>
35 #ifndef ddx_exceptions_h
36 #include "DDXExceptions.h"
47 #ifndef base_type_factory_h
48 #include "BaseTypeFactory.h"
89 inside_attribute_container,
91 inside_attribute_value,
92 inside_other_xml_attribute,
118 stack<BaseType*> bt_stack;
119 stack<AttrTable*> at_stack;
126 unsigned int other_xml_depth;
127 unsigned int unknown_depth;
131 xmlParserCtxtPtr ctxt;
138 string dods_attr_name;
139 string dods_attr_type;
149 void clone(
const XMLAttribute &src) {
155 XMLAttribute() : prefix(
""), nsURI(
""), value(
"") {}
156 XMLAttribute(
const string &p,
const string &ns,
const string &v)
157 : prefix(p), nsURI(ns), value(v) {}
160 XMLAttribute(
const xmlChar **attributes) {
161 prefix = attributes[0] != 0 ? (
const char *)attributes[0]:
"";
162 nsURI = attributes[1] != 0 ? (
const char *)attributes[1]:
"";
163 value = string((
const char *)attributes[2], (
const char *)attributes[3]);
165 XMLAttribute(
const XMLAttribute &rhs) {
168 XMLAttribute &operator=(
const XMLAttribute &rhs) {
176 typedef map<string, XMLAttribute> XMLAttrMap;
177 XMLAttrMap attribute_table;
179 XMLAttrMap::iterator attr_table_begin() {
180 return attribute_table.begin();
183 XMLAttrMap::iterator attr_table_end() {
184 return attribute_table.end();
187 map<string, string> namespace_table;
190 void set_state(DDXParser::ParseState state);
191 DDXParser::ParseState get_state()
const;
198 void cleanup_parse(xmlParserCtxtPtr &context);
206 void transfer_xml_attrs(
const xmlChar **attrs,
int nb_attributes);
207 void transfer_xml_ns(
const xmlChar **namespaces,
int nb_namespaces);
208 bool check_required_attribute(
const string &attr);
209 bool check_attribute(
const string & attr);
211 void process_attribute_element(
const xmlChar **attrs,
int nb_attrs);
212 void process_attribute_alias(
const xmlChar **attrs,
int nb_attrs);
214 void process_variable(
Type t, ParseState s,
const xmlChar **attrs,
217 void process_dimension(
const xmlChar **attrs,
int nb_attrs);
218 void process_blob(
const xmlChar **attrs,
int nb_attrs);
220 bool is_attribute_or_alias(
const char *name,
const xmlChar **attrs,
222 bool is_variable(
const char *name,
const xmlChar **attrs,
int nb_attributes);
224 void finish_variable(
const char *tag,
Type t,
const char *expected);
230 friend class DDXParserTest;
234 : d_factory(factory),
235 other_xml(
""), other_xml_depth(0), unknown_depth(0),
236 error_msg(
""), ctxt(0), dds(0), blob_href(0),
237 dods_attr_name(
""), dods_attr_type(
""),
238 char_data(
""), root_ns(
"")
241 void intern(
const string &document,
DDS *dest_dds,
string &cid);
242 void intern_stream(FILE *in,
DDS *dds,
string &cid,
const string &boundary =
"");
243 void intern_stream(istream &in,
DDS *dds,
string &cid,
const string &boundary =
"");
248 static void ddx_sax2_start_element(
void *parser,
249 const xmlChar *localname,
const xmlChar *prefix,
const xmlChar *URI,
250 int nb_namespaces,
const xmlChar **namespaces,
int nb_attributes,
251 int nb_defaulted,
const xmlChar **attributes);
252 static void ddx_sax2_end_element(
void *parser,
const xmlChar *localname,
253 const xmlChar *prefix,
const xmlChar *URI);
257 const xmlChar * ch,
int len);
258 static void ddx_get_cdata(
void *parser,
const xmlChar *value,
int len);
260 static xmlEntityPtr
ddx_get_entity(
void *parser,
const xmlChar *name);
266 #endif // ddx_parser_h
void intern_stream(FILE *in, DDS *dds, string &cid, const string &boundary="")
Read the DDX from a stream instead of a file.
static void ddx_start_document(void *parser)
static void ddx_get_cdata(void *parser, const xmlChar *value, int len)
Type
Identifies the data type.
static void ddx_fatal_error(void *parser, const char *msg,...)
static void ddx_end_document(void *parser)
static xmlEntityPtr ddx_get_entity(void *parser, const xmlChar *name)
static void ddx_get_characters(void *parser, const xmlChar *ch, int len)
The basic data type for the DODS DAP types.
static void ddx_ignoreable_whitespace(void *parser, const xmlChar *ch, int len)
void intern(const string &document, DDS *dest_dds, string &cid)