Document and Folder Creation

When Documents and Folders are referenced by the kml_document, and kml_parent format attributes, the KML writer will implicitly create the appropriate Document and Folder elements to contain the referencing features. Implicitly creating those elements ensures that the writer can properly maintain the dataset hierarchy.

The implicitly created Document and Folder elements can be overridden using features that have Document and Folder feature types. The documents should be uniquely identified using the kml_document format attribute, and the folders should be uniquely identified using the kml_id attribute. The kml_document and kml_id values should correspond to the values of the kml_document and kml_parent attributes on the referencing feature.

The root document/file is a special case. To override the <Document> element created for the root file, use a Document feature that does not have a kml_document attribute specified; the root document will be assumed.