KLM/KMZ to GPX – Namespace prefix ‘xsi’ not declared – [SOLVED]

I was trying to convert my Google Earth places (saved in KLM format) to GPX. Anything I tried was complaining that the XML is incorrect (Namespace prefix ‘xsi’ not declared).

It turns out that my KML file had a line like this:

<Folder xsi:schemaLocation=”http://earth.google.com/kml/2.1 http://earth.google.com/kml2.1.xsd”>

In order to fix the missing namespace we need to declare this a the beginning of the file. Open the file with any text editor and add

xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” to the kml tag.

<kml xmlns=”http://www.opengis.net/kml/2.2″ xmlns:gx=”http://www.google.com/kml/ext/2.2″ xmlns:kml=”http://www.opengis.net/kml/2.2″ xmlns:atom=”http://www.w3.org/2005/Atom”>

will become:

<kml xmlns=”http://www.opengis.net/kml/2.2″ xmlns:gx=”http://www.google.com/kml/ext/2.2″ xmlns:kml=”http://www.opengis.net/kml/2.2″ xmlns:atom=”http://www.w3.org/2005/Atom” xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”>

Now the XML is valid and you can convert to any format.

Csaba is passionate about Cyber Security, Pentesting and just making things work.

Leave a reply:

Your email address will not be published.

 

Site Footer

Sliding Sidebar