Google Earth Parse Error

CoastalDavid picture CoastalDavid · Sep 24, 2014 · Viewed 8.5k times · Source

I am unable to open my KML/KMZ file in Google Earth. The error I am getting is:

parse error at line 1, column 4 not well-formed (invalid token)

I have tried opening in Notepad++ and read everything but I cannot find how to fix the problem.

I would greatly appreciate if anyone can help. I am able to send the file in necessary.

Answer

JasonM1 picture JasonM1 · Sep 25, 2014

Basically, to fix an invalid KML file you first need to make sure the KML file is a well-formed XML file. That means it follows the basic rules of XML such as the start tags and end tags must be match. If the file has a .kmz extension then you need to unzip the .kml file from the compressed KMZ file. (KMZ is just a .zip file).

Given that the error is at line 1 should make fixing it simple.

The valid KML file should start with the following lines:

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
...

More detailed steps to repair an invalid KML file with an example can be found here.