openlayers/openlayers — pull request #1016 by Welshmilla (2013-06-21 16:42:00+00:00)
Title: Patch to move ExtendedData block in OpenLayers.Format.KML to pass Schema Validation

OpenLayers.Format.KML currently writes the ExtendedData block below the geometry block e.g:

<kml xmlns="http://www.opengis.net/kml/2.2">
<Folder>
<name>KML Test</name>
<Placemark>
<name>OpenLayers_Feature_Vector_491</name>
<description />
<Polygon>
<outerBoundaryIs>
<LinearRing>
<coordinates>276941.5,189961 277145.5,189944 277088.5,189710 276941.5,189961</coordinates>
</LinearRing>
</outerBoundaryIs>
</Polygon>
<ExtendedData>
<Data name="type">
<value>polygon</value>
</Data>
</ExtendedData>
</Placemark>
</Folder>
</kml>

This causes validation against the schema to fail e.g. using xmllint:

xmllint -schema http://schemas.opengis.net/kml/2.2.0/ogckml22.xsd test.kml

returns an error:

test.kml:14: element ExtendedData: Schemas validity error : Element '{http://www.opengis.net/kml/2.2}ExtendedData': This element is not expected.
test.kml fails to validate