user3719857 user3719857 - 1 year ago 204
Java Question

White spaces are required between publicId and systemId while parsing KML document

I get this error while I try to parse a KML document: Error parsing KML data
at org.quartz.simpl.SimpleThreadPool$
Caused by: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 50; White spaces are required between publicId and systemId.
at javax.xml.parsers.DocumentBuilder.parse(
... 3 more

The KML document can be found here .

Most probably there is some error in the formating of the kml file, but I don't know where and what it is. Any help is welcomed.

Part of the KML:

<?xml version="1.0" encoding="utf-8"?>
<kml xmlns="">
The Global Disaster Alert and Coordination System provides near real-time alerts about natural disasters around the world and tools to facilitate response coordination, including news, maps and V. OSOCC. GDACS is a joint initiative of the European Commission and the United Nations.
<name>Global Disaster Alert and Coordination system</name>
<name><![CDATA[ Tropical Cyclone HOWARD-16]]></name>
<Placemark id='TC_1000281'>
<name>Green Alert for Tropical Cyclone HOWARD-16 </name>
<data name="eventtype">
<data name = "eventid" >
</data >
<data name="episodeid">

Answer Source

The sample KML document is not a valid KML document. It has numerous errors which can cause various parsing errors. However, it is a well-formed XML document in that the start and end tags match and attributes are quoted.

  1. First type of errors result from out of order elements. KML 2.2 has a strict order of elements and elements should appear in the correct sequence.


    <description>The Global Disaster Alert...</description>
    <name>Global Disaster Alert and Coordination system</name>

The <name> field must be followed by the <description> element.

  1. Next type is the wrong element name. KML elements are case sensitive.

Example: <extendeddata> element must be renamed with <ExtendedData>.

  1. LineString for example has an altitude component (e.g. 30 meters) but the altitudeMode is missing so it is assumed clampToGround by default and altitude is ignored. If want the lines to appear off the ground then must specify altitudeMode absolute or relativeToGround.
       123.5,16.483,30 123.5814,16.491,30 ...


Must first validate the KML document using validator such as KML Validator or Feed Validator. There is also a command-line XML Validator tool. Then fix the validation errors.

Alternatively, you may want to disable schema and/or validation checking in the SAX parser.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download