+static void traverse(xmlNode *root);
+
+static void traverse_properties(xmlNode *node)
+{
+ xmlAttr *p;
+
+ for (p = node->properties; p; p = p->next)
+ traverse(p->children);
+}
+
+static void visit(xmlNode *n)
+{
+ visit_one_node(n);
+ traverse_properties(n);
+ traverse(n->children);
+}
+
+/*
+ * I'm sure this could be done as some fancy DTD rules.
+ * It's just not worth the headache.
+ */
+static struct nesting {
+ const char *name;
+ void (*start)(void), (*end)(void);
+} nesting[] = {
+ { "dive", dive_start, dive_end },
+ { "SUUNTO", suunto_start, suunto_end },
+ { "sample", sample_start, sample_end },
+ { "SAMPLE", sample_start, sample_end },
+ { "event", event_start, event_end },
+ { "gasmix", gasmix_start, gasmix_end },
+ { NULL, }
+};
+
+static void traverse(xmlNode *root)