}
if (info->name == NULL)
fail("Element not recognised");
- /* Note attribute count is doubled */
+ /* The attribute count is twice what you might expect. It is a
+ * count of items in atts, an array which contains alternating
+ * attribute names and attribute values. For the naive user this
+ * is possibly a little unexpected, but it is what the
+ * documentation in expat.h tells us to expect.
+ */
count = XML_GetSpecifiedAttributeCount(parser);
if (info->attr_count * 2 != count) {
fail("Not got expected attribute count");
fail("Attribute has wrong value");
return;
}
+ /* Remember, two entries in atts per attribute (see above) */
atts += 2;
}
}