Major refactoring of the code to check for categories as well as galleries.

Since a single file may be referenced by a gallery and a category (or multiple categories) we also need to implement a scoring system, to pick the best taxonomy for a file.

Obtaining the categories requires adjusting the current call to the Wikimedia API so that it returns categories in batches of 50 pages. Hence this commit also changes the way the SchemaDocument is saved, so that it is saved incrementally.
Minor adjustment to be able to get the filename from a SchemaDocument
Get GPS location data from a wikimedia page, if it is available
Small chang to routine spotting unused gallery files
Deduce taxonomy without making a request to the Wikimedia API, but by parsing the Taxonavigation template. This requires parsing "TaxonavigationIncluded" templates, so an extra pass of the XML dump is done.
Make license-checking stricter (case sensitive) when looking at licenses gained through categories.
Make the XML file saving actually work. Oops.
Revert to simpler check for extra genus / species lines after Taxonavigation block (only applies to a handful of pages)
Use the improved version of additional genus/species checking for API versio of taxonomy as well as wikitext version
Add missing semicolon.
Actually activate the new Taxonavigation template parsing code, by passing in the include arrays to taxon_parameters
Correct syntax error (missing bracket), and make cosmetic change when obtaining data_object_parameters
Use categories to spot distribution map images - requires connecting to the wikimedia toolserevr, or wmfLabs server to get all descendants of the base map category. This is saved to a local file in case either of the servers are down in the future.
Add comment about limitations on number of categories returned by Mediawiki API call.
Remove accidental whitespace
For consistency, use "echo" not "print" in a few places
Cosmetic changes to comments (spelling etc)
Correct a few coding mistakes in error message reporting, and when reading a previous MapCategory file
Adjusted API call to cope with cases where not all results are returned in the first query (using the "continue" parameter of the mediawiki API). We were hitting this a handful of times when accessing the full dataset.

Also more informative error reporting when calling the API (list full URL properly), although this is done by altering a reference to the ULR string (yuck).

Also allow get_map_categories() to be called without contacting the toolserver & wmf lab internet sites (quicker, for debugging only)
Better use of categories - only search ones gleaned from the API call (more reliable than parsing the wikitext)