Document Specification
The KML reader and writer are designed to simultaneously handle multiple KML files in the same translation. By default, the KML writer assumes that each feature sent to the writer should be written to the root file/document. To write a feature to an alternate document, the feature must have a kml_document attribute that contains the filename of the destination file/document.
When the KML reader reads a feature from a KML file other than the root file, it will add a kml_document attribute to the feature specifying the source documents filename. In addition, because it is possible for the reader to read two files with the same file name, but different file paths, the KML reader will also add the kml_document_path, and kml_document_href to assist in uniquely identifying the source document for each feature.