Folder Specification

Each feature that is written to the KML writer can also use the kml_parent format attribute to identify the <Folder> element that should contain the feature. The value of the kml_parent format attribute should be the same as the id of the Folder. The KML reader will also add kml_parent attributes as necessary. Note: if kml_parent is not specified, it is assumed that the container for a given feature is the <Document> element.

The kml_document and kml_parent format attributes are designed to be used in conjunction with each other. I.e. to add a Placemark feature to the folder "A" in document "other.kml", the feature needs to have the following attribute values: kml_document="other.kml" and kml_parent="A".