question: public boolean writeAsKML ( Writer writer , boolean isDocument , KmlDocument kmlDocument ) { try { String objectType ; if ( this instanceof KmlFolder ) { if ( isDocument ) objectType = "Document" ; else objectType = "Folder" ; } else if ( this instanceof KmlPlacemark ) objectType = "Placemark" ; else if ( this instanceof KmlGroundOverlay ) objectType = "GroundOverlay" ; else return false ; writer . write ( '<' + objectType ) ; if ( mId != null ) writer . write ( " id=\"mId\"" ) ; writer . write ( ">\n" ) ; if ( mStyle != null ) { writer . write ( "<styleUrl>#" + mStyle + "</styleUrl>\n" ) ; } if ( mName != null ) { writer . write ( "<name>" + StringEscapeUtils . escapeXml10 ( mName ) + "</name>\n" ) ; } if ( mDescription != null ) { writer . write ( "<description><![CDATA[" + mDescription + "]]></description>\n" ) ; } if ( ! mVisibility ) { writer . write ( "<visibility>0</visibility>\n" ) ; } writeKMLSpecifics ( writer ) ; writeKMLExtendedData ( writer ) ; if ( isDocument ) { kmlDocument . writeKMLStyles ( writer ) ; } writer . write ( "</" + objectType + ">\n" ) ; return true ; } catch ( IOException e ) { e . printStackTrace ( ) ; return false ; } }
target:  Write the object in KML text format (= save as a KML text file)