Initial work to support table stats and change XML.

This adds a non-backward compatible change to the XML
metadata format for tables. This is unfortunate but necessary
as the existing setup was not extensible, as we didn't have a
table root element.

Also changed the types in C api to be consistent with the Python
C api.