Looks like the raising of GPXException inside the parse method uses a message about requiring a gpx root node, but it doesn't actually check for one. Instead, it is only checking for the existence of root. What this means in practice is that no errors are thrown if I load a different format's valid XML, for example a KML file.
I would like to propose that this line in parser.py be changed from:
if root is None:
raise mod_gpx.GPXException('Document must have a `gpx` root node.')
to:
if root is None or root.tag.lower() != 'gpx':
raise mod_gpx.GPXException('Document must have a `gpx` root node.')
Looks like the raising of GPXException inside the parse method uses a message about requiring a
gpx
root node, but it doesn't actually check for one. Instead, it is only checking for the existence of root. What this means in practice is that no errors are thrown if I load a different format's valid XML, for example a KML file.I would like to propose that this line in parser.py be changed from:
to: