7 #include <libxml/parser.h>
8 #include <libxml/tree.h>
14 struct dive_table dive_table;
17 * Add a dive into the dive_table array
19 static void record_dive(struct dive *dive)
21 int nr = dive_table.nr, allocated = dive_table.allocated;
22 struct dive **dives = dive_table.dives;
24 if (nr >= allocated) {
25 allocated = (nr + 32) * 3 / 2;
26 dives = realloc(dives, allocated * sizeof(struct dive *));
29 dive_table.dives = dives;
30 dive_table.allocated = allocated;
32 dives[nr] = fixup_dive(dive);
36 static void start_match(const char *type, const char *name, char *buffer)
39 printf("Matching %s '%s' (%s)\n",
43 static void nonmatch(const char *type, const char *name, char *buffer)
46 printf("Unable to match %s '%s' (%s)\n",
51 typedef void (*matchfn_t)(char *buffer, void *);
53 static int match(const char *pattern, int plen,
54 const char *name, int nlen,
55 matchfn_t fn, char *buf, void *data)
59 if (memcmp(pattern, name + nlen - plen, plen))
66 * We keep our internal data in well-specified units, but
67 * the input may come in some random format. This keeps track
68 * of the incoming units.
71 enum { METERS, FEET } length;
72 enum { LITER, CUFT } volume;
73 enum { BAR, PSI } pressure;
74 enum { CELSIUS, FAHRENHEIT } temperature;
75 enum { KG, LBS } weight;
78 /* We're going to default to SI units for input */
79 static const struct units SI_units = {
83 .temperature = CELSIUS,
88 * Dive info as it is being built up..
90 static int alloc_samples;
91 static struct dive *dive;
92 static struct sample *sample;
94 static int suunto, uemis;
95 static int event_index, cylinder_index;
97 static time_t utc_mktime(struct tm *tm)
99 static const int mdays[] = {
100 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334
102 int year = tm->tm_year;
103 int month = tm->tm_mon;
104 int day = tm->tm_mday;
106 /* First normalize relative to 1900 */
109 else if (year > 1900)
112 /* Normalized to Jan 1, 1970: unix time */
115 if (year < 0 || year > 129) /* algo only works for 1970-2099 */
117 if (month < 0 || month > 11) /* array bounds */
119 if (month < 2 || (year + 2) % 4)
121 if (tm->tm_hour < 0 || tm->tm_min < 0 || tm->tm_sec < 0)
123 return (year * 365 + (year + 1) / 4 + mdays[month] + day) * 24*60*60UL +
124 tm->tm_hour * 60*60 + tm->tm_min * 60 + tm->tm_sec;
127 static void divedate(char *buffer, void *_when)
130 time_t *when = _when;
133 success = tm.tm_sec | tm.tm_min | tm.tm_hour;
134 if (sscanf(buffer, "%d.%d.%d", &d, &m, &y) == 3) {
138 } else if (sscanf(buffer, "%d-%d-%d", &y, &m, &d) == 3) {
143 fprintf(stderr, "Unable to parse date '%s'\n", buffer);
148 *when = utc_mktime(&tm);
153 static void divetime(char *buffer, void *_when)
156 time_t *when = _when;
158 if (sscanf(buffer, "%d:%d:%d", &h, &m, &s) >= 2) {
163 *when = utc_mktime(&tm);
168 /* Libdivecomputer: "2011-03-20 10:22:38" */
169 static void divedatetime(char *buffer, void *_when)
173 time_t *when = _when;
175 if (sscanf(buffer, "%d-%d-%d %d:%d:%d",
176 &y, &m, &d, &hr, &min, &sec) == 6) {
183 *when = utc_mktime(&tm);
197 static enum number_type integer_or_float(char *buffer, union int_or_float *res)
203 /* Integer or floating point? */
204 val = strtol(buffer, &end, 10);
205 if (val < 0 || end == buffer)
208 /* Looks like it might be floating point? */
211 fp = strtod(buffer, &end);
222 static void pressure(char *buffer, void *_press)
225 pressure_t *pressure = _press;
226 union int_or_float val;
228 switch (integer_or_float(buffer, &val)) {
230 /* Just ignore zero values */
233 switch (units.pressure) {
235 /* Assume mbar, but if it's really small, it's bar */
241 mbar = val.fp * 68.95;
244 if (mbar > 5 && mbar < 500000) {
245 pressure->mbar = mbar + 0.5;
250 printf("Strange pressure reading %s\n", buffer);
255 static void depth(char *buffer, void *_depth)
257 depth_t *depth = _depth;
258 union int_or_float val;
260 switch (integer_or_float(buffer, &val)) {
262 switch (units.length) {
264 depth->mm = val.fp * 1000 + 0.5;
267 depth->mm = val.fp * 304.8 + 0.5;
272 printf("Strange depth reading %s\n", buffer);
277 static void temperature(char *buffer, void *_temperature)
279 temperature_t *temperature = _temperature;
280 union int_or_float val;
282 switch (integer_or_float(buffer, &val)) {
284 /* Ignore zero. It means "none" */
288 switch (units.temperature) {
290 temperature->mkelvin = (val.fp + 273.15) * 1000 + 0.5;
293 temperature->mkelvin = (val.fp + 459.67) * 5000/9;
298 printf("Strange temperature reading %s\n", buffer);
303 static void sampletime(char *buffer, void *_time)
307 duration_t *time = _time;
309 i = sscanf(buffer, "%d:%d", &min, &sec);
316 time->seconds = sec + min*60;
319 printf("Strange sample time reading %s\n", buffer);
324 static void duration(char *buffer, void *_time)
326 sampletime(buffer, _time);
329 static void percent(char *buffer, void *_fraction)
331 fraction_t *fraction = _fraction;
332 union int_or_float val;
334 switch (integer_or_float(buffer, &val)) {
337 fraction->permille = val.fp * 10 + 0.5;
341 printf("Strange percentage reading %s\n", buffer);
347 static void gasmix(char *buffer, void *_fraction)
349 /* libdivecomputer does negative percentages. */
352 if (cylinder_index < MAX_CYLINDERS)
353 percent(buffer, _fraction);
356 static void gasmix_nitrogen(char *buffer, void *_gasmix)
358 /* Ignore n2 percentages. There's no value in them. */
361 static void cylindersize(char *buffer, void *_volume)
363 volume_t *volume = _volume;
364 union int_or_float val;
366 switch (integer_or_float(buffer, &val)) {
368 volume->mliter = val.fp * 1000 + 0.5;
372 printf("Strange volume reading %s\n", buffer);
378 static void utf8_string(char *buffer, void *_res)
380 *(char **)_res = buffer;
384 * Uemis water_pressure. In centibar. And when converting to
385 * depth, I'm just going to always use saltwater, because I
386 * think "true depth" is just stupid. From a diving standpoint,
387 * "true depth" is pretty much completely pointless, unless
388 * you're doing some kind of underwater surveying work.
390 * So I give water depths in "pressure depth", always assuming
391 * salt water. So one atmosphere per 10m.
393 static void water_pressure(char *buffer, void *_depth)
395 depth_t *depth = _depth;
396 union int_or_float val;
399 switch (integer_or_float(buffer, &val)) {
404 atm = (val.fp / 100) / 1.01325;
406 * atm to cm. Why not mm? The precision just isn't
409 cm = 100 * (atm - 1) + 0.5;
411 depth->mm = 10 * (long)cm;
415 fprintf(stderr, "Strange water pressure '%s'\n", buffer);
420 #define MATCH(pattern, fn, dest) \
421 match(pattern, strlen(pattern), name, len, fn, buf, dest)
423 static void get_index(char *buffer, void *_i)
430 static void centibar(char *buffer, void *_pressure)
432 pressure_t *pressure = _pressure;
433 union int_or_float val;
435 switch (integer_or_float(buffer, &val)) {
437 pressure->mbar = val.fp * 10 + 0.5;
440 fprintf(stderr, "Strange centibar pressure '%s'\n", buffer);
445 static void decicelsius(char *buffer, void *_temp)
447 temperature_t *temp = _temp;
448 union int_or_float val;
450 switch (integer_or_float(buffer, &val)) {
452 temp->mkelvin = (val.fp/10 + 273.15) * 1000 + 0.5;
455 fprintf(stderr, "Strange julian date: %s", buffer);
460 static int uemis_fill_sample(struct sample *sample, const char *name, int len, char *buf)
462 return MATCH(".reading.dive_time", sampletime, &sample->time) ||
463 MATCH(".reading.water_pressure", water_pressure, &sample->depth) ||
464 MATCH(".reading.active_tank", get_index, &sample->cylinderindex) ||
465 MATCH(".reading.tank_pressure", centibar, &sample->cylinderpressure) ||
466 MATCH(".reading.dive_temperature", decicelsius, &sample->temperature) ||
470 /* We're in samples - try to convert the random xml value to something useful */
471 static void try_to_fill_sample(struct sample *sample, const char *name, char *buf)
473 int len = strlen(name);
475 start_match("sample", name, buf);
476 if (MATCH(".sample.pressure", pressure, &sample->cylinderpressure))
478 if (MATCH(".sample.cylpress", pressure, &sample->cylinderpressure))
480 if (MATCH(".sample.depth", depth, &sample->depth))
482 if (MATCH(".sample.temp", temperature, &sample->temperature))
484 if (MATCH(".sample.temperature", temperature, &sample->temperature))
486 if (MATCH(".sample.sampletime", sampletime, &sample->time))
488 if (MATCH(".sample.time", sampletime, &sample->time))
492 if (uemis_fill_sample(sample, name, len, buf))
496 nonmatch("sample", name, buf);
500 * Crazy suunto xml. Look at how those o2/he things match up.
502 static int suunto_dive_match(struct dive *dive, const char *name, int len, char *buf)
504 return MATCH(".o2pct", percent, &dive->cylinder[0].gasmix.o2) ||
505 MATCH(".hepct_0", percent, &dive->cylinder[0].gasmix.he) ||
506 MATCH(".o2pct_2", percent, &dive->cylinder[1].gasmix.o2) ||
507 MATCH(".hepct_1", percent, &dive->cylinder[1].gasmix.he) ||
508 MATCH(".o2pct_3", percent, &dive->cylinder[2].gasmix.o2) ||
509 MATCH(".hepct_2", percent, &dive->cylinder[2].gasmix.he) ||
510 MATCH(".o2pct_4", percent, &dive->cylinder[3].gasmix.o2) ||
511 MATCH(".hepct_3", percent, &dive->cylinder[3].gasmix.he) ||
512 MATCH(".cylindersize", cylindersize, &dive->cylinder[0].type.size) ||
513 MATCH(".cylinderworkpressure", pressure, &dive->cylinder[0].type.workingpressure) ||
517 static int buffer_value(char *buffer)
519 int val = atoi(buffer);
524 static void uemis_length_unit(char *buffer, void *_unused)
526 units.length = buffer_value(buffer) ? FEET : METERS;
529 static void uemis_volume_unit(char *buffer, void *_unused)
531 units.volume = buffer_value(buffer) ? CUFT : LITER;
534 static void uemis_pressure_unit(char *buffer, void *_unused)
537 units.pressure = buffer_value(buffer) ? PSI : BAR;
541 static void uemis_temperature_unit(char *buffer, void *_unused)
543 units.temperature = buffer_value(buffer) ? FAHRENHEIT : CELSIUS;
546 static void uemis_weight_unit(char *buffer, void *_unused)
548 units.weight = buffer_value(buffer) ? LBS : KG;
551 static void uemis_time_unit(char *buffer, void *_unused)
555 static void uemis_date_unit(char *buffer, void *_unused)
559 /* Modified julian day, yay! */
560 static void uemis_date_time(char *buffer, void *_when)
562 time_t *when = _when;
563 union int_or_float val;
565 switch (integer_or_float(buffer, &val)) {
567 *when = (val.fp - 40587.5) * 86400;
570 fprintf(stderr, "Strange julian date: %s", buffer);
576 * Uemis doesn't know time zones. You need to do them as
577 * minutes, not hours.
579 * But that's ok, we don't track timezones yet either. We
580 * just turn everything into "localtime expressed as UTC".
582 static void uemis_time_zone(char *buffer, void *_when)
584 time_t *when = _when;
585 signed char tz = atoi(buffer);
590 /* 0 - air ; 1 - nitrox1 ; 2 - nitrox2 ; 3 = nitrox3 */
591 static int uemis_gas_template;
594 * Christ. Uemis tank data is a total mess.
596 * We're passed a "virtual cylinder" (0 - 6) for the different
597 * Uemis tank cases ("air", "nitrox_1", "nitrox_2.{bottom,deco}"
598 * and "nitrox_3.{bottom,deco,travel}". We need to turn that
599 * into the actual cylinder data depending on the gas template,
600 * and ignore the ones that are irrelevant for that template.
602 * So for "template 2" (nitrox_2), we ignore virtual tanks 0-1
603 * (which are "air" and "nitrox_1" respectively), and tanks 4-6
604 * (which are the three "nitrox_3" tanks), and we turn virtual
605 * tanks 2/3 into actual tanks 0/1.
609 static int uemis_cylinder_index(void *_cylinder)
611 cylinder_t *cylinder = _cylinder;
612 unsigned int index = cylinder - dive->cylinder;
615 fprintf(stderr, "Uemis cylinder pointer calculations broken\n");
618 switch(uemis_gas_template) {
619 case 1: /* Dive uses tank 1 */
622 case 0: /* Dive uses tank 0 */
626 case 2: /* Dive uses tanks 2-3 */
631 case 3: /* Dive uses tanks 4-6 */
640 static void uemis_cylindersize(char *buffer, void *_cylinder)
642 int index = uemis_cylinder_index(_cylinder);
644 cylindersize(buffer, &dive->cylinder[index].type.size);
647 static void uemis_percent(char *buffer, void *_cylinder)
649 int index = uemis_cylinder_index(_cylinder);
651 percent(buffer, &dive->cylinder[index].gasmix.o2);
654 static int uemis_dive_match(struct dive *dive, const char *name, int len, char *buf)
656 return MATCH(".units.length", uemis_length_unit, &units) ||
657 MATCH(".units.volume", uemis_volume_unit, &units) ||
658 MATCH(".units.pressure", uemis_pressure_unit, &units) ||
659 MATCH(".units.temperature", uemis_temperature_unit, &units) ||
660 MATCH(".units.weight", uemis_weight_unit, &units) ||
661 MATCH(".units.time", uemis_time_unit, &units) ||
662 MATCH(".units.date", uemis_date_unit, &units) ||
663 MATCH(".date_time", uemis_date_time, &dive->when) ||
664 MATCH(".time_zone", uemis_time_zone, &dive->when) ||
665 MATCH(".ambient.temperature", decicelsius, &dive->airtemp) ||
666 MATCH(".gas.template", get_index, &uemis_gas_template) ||
667 MATCH(".air.bottom_tank.size", uemis_cylindersize, dive->cylinder + 0) ||
668 MATCH(".air.bottom_tank.oxygen", uemis_percent, dive->cylinder + 0) ||
669 MATCH(".nitrox_1.bottom_tank.size", uemis_cylindersize, dive->cylinder + 1) ||
670 MATCH(".nitrox_1.bottom_tank.oxygen", uemis_percent, dive->cylinder + 1) ||
671 MATCH(".nitrox_2.bottom_tank.size", uemis_cylindersize, dive->cylinder + 2) ||
672 MATCH(".nitrox_2.bottom_tank.oxygen", uemis_percent, dive->cylinder + 2) ||
673 MATCH(".nitrox_2.deco_tank.size", uemis_cylindersize, dive->cylinder + 3) ||
674 MATCH(".nitrox_2.deco_tank.oxygen", uemis_percent, dive->cylinder + 3) ||
675 MATCH(".nitrox_3.bottom_tank.size", uemis_cylindersize, dive->cylinder + 4) ||
676 MATCH(".nitrox_3.bottom_tank.oxygen", uemis_percent, dive->cylinder + 4) ||
677 MATCH(".nitrox_3.deco_tank.size", uemis_cylindersize, dive->cylinder + 5) ||
678 MATCH(".nitrox_3.deco_tank.oxygen", uemis_percent, dive->cylinder + 5) ||
679 MATCH(".nitrox_3.travel_tank.size", uemis_cylindersize, dive->cylinder + 6) ||
680 MATCH(".nitrox_3.travel_tank.oxygen", uemis_percent, dive->cylinder + 6) ||
684 /* We're in the top-level dive xml. Try to convert whatever value to a dive value */
685 static void try_to_fill_dive(struct dive *dive, const char *name, char *buf)
687 int len = strlen(name);
689 start_match("dive", name, buf);
690 if (MATCH(".date", divedate, &dive->when))
692 if (MATCH(".time", divetime, &dive->when))
694 if (MATCH(".datetime", divedatetime, &dive->when))
696 if (MATCH(".maxdepth", depth, &dive->maxdepth))
698 if (MATCH(".meandepth", depth, &dive->meandepth))
700 if (MATCH(".depth.max", depth, &dive->maxdepth))
702 if (MATCH(".depth.mean", depth, &dive->meandepth))
704 if (MATCH(".duration", duration, &dive->duration))
706 if (MATCH(".divetime", duration, &dive->duration))
708 if (MATCH(".divetimesec", duration, &dive->duration))
710 if (MATCH(".surfacetime", duration, &dive->surfacetime))
712 if (MATCH(".airtemp", temperature, &dive->airtemp))
714 if (MATCH(".watertemp", temperature, &dive->watertemp))
716 if (MATCH(".temperature.air", temperature, &dive->airtemp))
718 if (MATCH(".temperature.water", temperature, &dive->watertemp))
720 if (MATCH(".cylinderstartpressure", pressure, &dive->cylinder[0].start))
722 if (MATCH(".cylinderendpressure", pressure, &dive->cylinder[0].end))
724 if (MATCH(".location", utf8_string, &dive->location))
726 if (MATCH(".notes", utf8_string, &dive->notes))
729 if (MATCH(".cylinder.size", cylindersize, &dive->cylinder[cylinder_index].type.size))
731 if (MATCH(".cylinder.workpressure", pressure, &dive->cylinder[cylinder_index].type.workingpressure))
733 if (MATCH(".cylinder.description", utf8_string, &dive->cylinder[cylinder_index].type.description))
735 if (MATCH(".cylinder.start", pressure, &dive->cylinder[cylinder_index].start))
737 if (MATCH(".cylinder.end", pressure, &dive->cylinder[cylinder_index].end))
740 if (MATCH(".o2", gasmix, &dive->cylinder[cylinder_index].gasmix.o2))
742 if (MATCH(".n2", gasmix_nitrogen, &dive->cylinder[cylinder_index].gasmix))
744 if (MATCH(".he", gasmix, &dive->cylinder[cylinder_index].gasmix.he))
747 /* Suunto XML files are some crazy sh*t. */
748 if (suunto && suunto_dive_match(dive, name, len, buf))
751 if (uemis && uemis_dive_match(dive, name, len, buf))
754 nonmatch("dive", name, buf);
758 * File boundaries are dive boundaries. But sometimes there are
759 * multiple dives per file, so there can be other events too that
760 * trigger a "new dive" marker and you may get some nesting due
761 * to that. Just ignore nesting levels.
763 static void dive_start(void)
771 size = dive_size(alloc_samples);
775 memset(dive, 0, size);
776 memset(&tm, 0, sizeof(tm));
779 static void sanitize_gasmix(gasmix_t *mix)
783 o2 = mix->o2.permille;
784 he = mix->he.permille;
786 /* Regular air: leave empty */
790 /* 20.9% or 21% O2 is just air */
791 if (o2 >= 209 && o2 <= 210) {
792 mix->o2.permille = 0;
798 if (o2 <= 1000 && he <= 1000 && o2+he <= 1000)
800 fprintf(stderr, "Odd gasmix: %d O2 %d He\n", o2, he);
801 memset(mix, 0, sizeof(*mix));
805 * See if the size/workingpressure looks like some standard cylinder
808 static void match_standard_cylinder(cylinder_type_t *type)
814 /* Do we already have a cylinder description? */
815 if (type->description)
818 cuft = type->size.mliter / 1000;
819 psi = type->workingpressure.mbar / 68.95;
822 case 2300 ... 2500: /* 2400 psi: LP tank */
825 case 2600 ... 2700: /* 2640 psi: LP+10% */
828 case 2900 ... 3100: /* 3000 psi: ALx tank */
831 case 3400 ... 3500: /* 3442 psi: HP tank */
834 case 3700 ... 3850: /* HP+10% */
840 len = snprintf(buffer, sizeof(buffer), fmt, cuft);
844 memcpy(p, buffer, len+1);
845 type->description = p;
850 * There are two ways to give cylinder size information:
851 * - total amount of gas in cuft (depends on working pressure and physical size)
854 * where "physical size" is the one that actually matters and is sane.
856 * We internally use physical size only. But we save the workingpressure
857 * so that we can do the conversion if required.
859 static void sanitize_cylinder_type(cylinder_type_t *type)
861 double volume_of_air, atm, volume;
863 /* If we have no working pressure, it had *better* be just a physical size! */
864 if (!type->workingpressure.mbar)
867 /* No size either? Nothing to go on */
868 if (!type->size.mliter)
871 /* Ok, we have both size and pressure: try to match a description */
872 match_standard_cylinder(type);
874 /* .. and let's assume that the 'size' was cu ft of air */
875 volume_of_air = type->size.mliter * 28.317; /* milli-cu ft to milliliter */
876 atm = type->workingpressure.mbar / 1013.25; /* working pressure in atm */
877 volume = volume_of_air / atm; /* milliliters at 1 atm: "true size" */
878 type->size.mliter = volume + 0.5;
881 static void sanitize_cylinder_info(struct dive *dive)
885 for (i = 0; i < MAX_CYLINDERS; i++) {
886 sanitize_gasmix(&dive->cylinder[i].gasmix);
887 sanitize_cylinder_type(&dive->cylinder[i].type);
891 static void dive_end(void)
895 sanitize_cylinder_info(dive);
901 static void suunto_start(void)
907 static void suunto_end(void)
912 static void uemis_start(void)
918 static void uemis_end(void)
922 static void event_start(void)
926 static void event_end(void)
931 static void cylinder_start(void)
935 static void cylinder_end(void)
940 static void sample_start(void)
947 if (nr >= alloc_samples) {
950 alloc_samples = (alloc_samples * 3)/2 + 10;
951 size = dive_size(alloc_samples);
952 dive = realloc(dive, size);
956 sample = dive->sample + nr;
957 memset(sample, 0, sizeof(*sample));
961 static void sample_end(void)
970 static void entry(const char *name, int size, const char *raw)
972 char *buf = malloc(size+1);
976 memcpy(buf, raw, size);
979 try_to_fill_sample(sample, name, buf);
983 try_to_fill_dive(dive, name, buf);
988 static const char *nodename(xmlNode *node, char *buf, int len)
990 if (!node || !node->name)
998 const char *name = node->name;
999 int i = strlen(name);
1001 unsigned char c = name[i];
1002 *--buf = tolower(c);
1006 node = node->parent;
1007 if (!node || !node->name)
1017 static void visit_one_node(xmlNode *node)
1020 const unsigned char *content;
1021 char buffer[MAXNAME];
1024 content = node->content;
1028 /* Trim whitespace at beginning */
1029 while (isspace(*content))
1032 /* Trim whitespace at end */
1033 len = strlen(content);
1034 while (len && isspace(content[len-1]))
1040 /* Don't print out the node name if it is "text" */
1041 if (!strcmp(node->name, "text"))
1042 node = node->parent;
1044 name = nodename(node, buffer, sizeof(buffer));
1046 entry(name, len, content);
1049 static void traverse(xmlNode *root);
1051 static void traverse_properties(xmlNode *node)
1055 for (p = node->properties; p; p = p->next)
1056 traverse(p->children);
1059 static void visit(xmlNode *n)
1062 traverse_properties(n);
1063 traverse(n->children);
1067 * I'm sure this could be done as some fancy DTD rules.
1068 * It's just not worth the headache.
1070 static struct nesting {
1072 void (*start)(void), (*end)(void);
1074 { "dive", dive_start, dive_end },
1075 { "SUUNTO", suunto_start, suunto_end },
1076 { "sample", sample_start, sample_end },
1077 { "SAMPLE", sample_start, sample_end },
1078 { "reading", sample_start, sample_end },
1079 { "event", event_start, event_end },
1080 { "gasmix", cylinder_start, cylinder_end },
1081 { "cylinder", cylinder_start, cylinder_end },
1082 { "pre_dive", uemis_start, uemis_end },
1086 static void traverse(xmlNode *root)
1090 for (n = root; n; n = n->next) {
1091 struct nesting *rule = nesting;
1094 if (!strcmp(rule->name, n->name))
1097 } while (rule->name);
1107 /* Per-file reset */
1108 static void reset_all(void)
1111 * We reset the units for each file. You'd think it was
1112 * a per-dive property, but I'm not going to trust people
1113 * to do per-dive setup. If the xml does have per-dive
1114 * data within one file, we might have to reset it per
1115 * dive for that format.
1122 void parse_xml_file(const char *filename)
1126 doc = xmlReadFile(filename, NULL, 0);
1128 fprintf(stderr, "Failed to parse '%s'.\n", filename);
1134 traverse(xmlDocGetRootElement(doc));
1140 void parse_xml_init(void)