2

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 !

maycca
  • 3,848
  • 5
  • 36
  • 67

1 Answers1

5

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>
CodeMonkey
  • 22,825
  • 4
  • 35
  • 75
  • thank you @JasonM1. Please, where in my code should I insert the xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> ? is .kml indentation and space specific? Is there a way how to save a correct .kml file from GE without my manual adjustement of coding? – maycca Jan 30 '17 at 14:46
  • GE won't add/fix namespaces in your KML. Unbound namespaces remain. Will need to open in text editor and manually add then validate it outside of GE. – CodeMonkey Jan 30 '17 at 15:00
  • Please, what part of a code should I insert, and where in my code? unfortunatelly, I have not experiences with klm.. please, do I need only to add xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" in my code? please, would you mind to insert it in the correct place in my attached file? – maycca Jan 30 '17 at 15:48
  • Hi @JasonM1, I have added the "xmlns:xsi" part of code in my .kml. When I add .xml extension and drop it to Chrome, i get the message: "This XML file does not appear to have any style information associated with it. The document tree is shown below." is this considered as the error too? – maycca Jan 30 '17 at 16:07
  • 2
    Try to remove the attribute `xsi:schemaLocation="..."` from your original KML file. It is not required. – CodeMonkey Jan 30 '17 at 17:42
  • I del;eted it and I still have a saying: "This XML file does not appear to have any style information associated with it. The document tree is shown below." – maycca Jan 30 '17 at 18:16
  • apparently, following this post, I don't need any style sheet? http://stackoverflow.com/questions/14804452/opening-facelets-page-errors-with-this-xml-file-does-not-appear-to-have-any-sty Could that be true? – maycca Jan 30 '17 at 18:19
  • Correct. You don't need any style sheets. Try opening XML file with Internet Explorer (IE). Error might be bogus. – CodeMonkey Jan 30 '17 at 18:20
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/134403/discussion-between-jasonm1-and-maycca). – CodeMonkey Jan 30 '17 at 18:42
  • Just for record, I attach the schema of the valid .kml file: https://developers.google.com/kml/schema/kml21.xsd?csw=1 with missing style information: "This XML file does not appear to have any style information associated with it. The document tree is shown below." Thus I assume this is correct .kml file. Thank you for your help, I really appreciate it, I was totally new in .kml – maycca Jan 31 '17 at 13:38