Search code examples
debuggingkmlgoogle-earth

Debug KML: Namespace prefix xsi for schemaLocation on Document is not defined


I would like to submit the KML file generated by ArcGIS 10.1 and GoogleEarthPRO (GE) as supplementary data for my paper in Elsevier.

However, the reviewer wrote me back: "here is an error in the prefix "xsi" for attribute "xsi:schemaLocation”.

When I tried the simple validation of KML file by adding .xml extension and dropping to Chrome (following: http://kml4earth.appspot.com/kmlBestPractice.html) , I've got an error:

error on line 3 at column 217: Namespace prefix xsi for schemaLocation
on Document is not defined

I generated the KML by ArcGIS 10.1 (shp to KML, tool: Layer To KML), which produced the zipped .kmz file. I opened the .kmz file in GoogleEarthPRO and again saved my place as .kml file. Apparenly, the .kml file works well as I can open the file in GE and share it between PC.

enter image description here

I also tried the KMLvalidator here: http://www.kmlvalidator.org/validate.htm with error:

File upload request was rejected. (/data/tomcat/base-kml-validator/temp/upload_2a88fa18_1591832a38f__7fff_00001631.tmp (No such file or directory)).

I don't understand why my .kml file seems to work fine in GoogleEarthPRO on multiple PCs, but it apparently contains the error in xsi for schemaLocation? The most important, what is the easiest way to fix it?

I am not familiar with scripting the KML code, I am just a beginner and user of GE. Please, how can easily fix my schemaLocation?

File to download: https://www.dropbox.com/s/azmc6m1ksvtau7o/high_tatra_mts.kml?dl=0

Thank you !


Solution

  • Google Earth generally ignores namespaces and XML elements it doesn't know about so a KML file that is an invalid XML file may still be viewable in Google Earth. To enable error checking in Google Earth, open Tools/Options/General and check the "Show prompts for all errors" option then open your KML file.

    If there is a namespace error in your KML file then you need to declare it in KML file - typically in the root element.

    Here is the structure of a valid KML file:

    <?xml version="1.0" encoding="UTF-8"?>
    <kml xmlns="http://www.opengis.net/kml/2.2"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 
    ...
    </kml>
    

    Note that Google Earth will not fix invalid namespace references in your KML so these must be fixed in a text editor and validated externally to Google Earth.

    In your particular example, the xsi declaration and schemaLocation attributes are unnecessary so your KML can be simplified to this:

    <kml xmlns="http://www.opengis.net/kml/2.2">
    ..
    </kml>