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) {
170 XMLAttribute &operator=(
const XMLAttribute &rhs) {
178 typedef map<string, XMLAttribute> XMLAttrMap;
179 XMLAttrMap attribute_table;
181 XMLAttrMap::iterator attr_table_begin() {
182 return attribute_table.begin();
185 XMLAttrMap::iterator attr_table_end() {
186 return attribute_table.end();
189 map<string, string> namespace_table;
192 void set_state(DDXParser::ParseState state);
193 DDXParser::ParseState get_state()
const;
200 void cleanup_parse(xmlParserCtxtPtr &context);
208 void transfer_xml_attrs(
const xmlChar **attrs,
int nb_attributes);
209 void transfer_xml_ns(
const xmlChar **namespaces,
int nb_namespaces);
210 bool check_required_attribute(
const string &attr);
211 bool check_attribute(
const string & attr);
213 void process_attribute_element(
const xmlChar **attrs,
int nb_attrs);
214 void process_attribute_alias(
const xmlChar **attrs,
int nb_attrs);
216 void process_variable(
Type t, ParseState s,
const xmlChar **attrs,
219 void process_dimension(
const xmlChar **attrs,
int nb_attrs);
220 void process_blob(
const xmlChar **attrs,
int nb_attrs);
222 bool is_attribute_or_alias(
const char *name,
const xmlChar **attrs,
224 bool is_variable(
const char *name,
const xmlChar **attrs,
int nb_attributes);
226 void finish_variable(
const char *tag,
Type t,
const char *expected);
232 friend class DDXParserTest;
236 : d_factory(factory),
237 other_xml(
""), other_xml_depth(0), unknown_depth(0),
238 error_msg(
""), ctxt(0), dds(0), blob_href(0),
239 dods_attr_name(
""), dods_attr_type(
""),
240 char_data(
""), root_ns(
"")
243 void intern(
const string &document,
DDS *dest_dds,
string &cid);
244 void intern_stream(FILE *in,
DDS *dds,
string &cid,
const string &boundary =
"");
245 void intern_stream(istream &in,
DDS *dds,
string &cid,
const string &boundary =
"");
250 static void ddx_sax2_start_element(
void *parser,
251 const xmlChar *localname,
const xmlChar *prefix,
const xmlChar *URI,
252 int nb_namespaces,
const xmlChar **namespaces,
int nb_attributes,
253 int nb_defaulted,
const xmlChar **attributes);
254 static void ddx_sax2_end_element(
void *parser,
const xmlChar *localname,
255 const xmlChar *prefix,
const xmlChar *URI);
259 const xmlChar * ch,
int len);
260 static void ddx_get_cdata(
void *parser,
const xmlChar *value,
int len);
262 static xmlEntityPtr
ddx_get_entity(
void *parser,
const xmlChar *name);
268 #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.
top level DAP object to house generic methods
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)