Index: /issm/trunk/src/c/Makefile.am
===================================================================
--- /issm/trunk/src/c/Makefile.am	(revision 10839)
+++ /issm/trunk/src/c/Makefile.am	(revision 10840)
@@ -644,4 +644,6 @@
 			     ./objects/KML/KML_Attribute.cpp\
 			     ./objects/KML/KML_Attribute.h\
+			     ./objects/KML/KML_Comment.cpp\
+			     ./objects/KML/KML_Comment.h\
 			     ./objects/KML/KML_ColorStyle.cpp\
 			     ./objects/KML/KML_ColorStyle.h\
Index: /issm/trunk/src/c/modules/KMLMeshWritex/KMLFileReadx.cpp
===================================================================
--- /issm/trunk/src/c/modules/KMLMeshWritex/KMLFileReadx.cpp	(revision 10839)
+++ /issm/trunk/src/c/modules/KMLMeshWritex/KMLFileReadx.cpp	(revision 10840)
@@ -25,5 +25,6 @@
 /*  read kml file  */
 
-	while (kstr=KMLFileToken(fid)) {
+	while (kstr=KMLFileToken(fid,
+							 NULL,NULL)) {
 		if      (!strncmp(kstr,"<?xml"    ,5)) {
 			kxml=new KML_File();
Index: /issm/trunk/src/c/objects/KML/KMLFileReadUtils.cpp
===================================================================
--- /issm/trunk/src/c/objects/KML/KMLFileReadUtils.cpp	(revision 10839)
+++ /issm/trunk/src/c/objects/KML/KMLFileReadUtils.cpp	(revision 10840)
@@ -20,6 +20,7 @@
 /*}}}*/
 
-/*FUNCTION  KMLFileToken(FILE* fid) {{{1*/
-char* KMLFileToken(FILE* fid){
+/*FUNCTION  KMLFileToken(FILE* fid,int* pncom=NULL,char*** ppcom=NULL) {{{1*/
+char* KMLFileToken(FILE* fid,
+				   int* pncom=NULL,char*** ppcom=NULL){
 
 /*  get the next token (tag or field) in the file  */
@@ -54,5 +55,11 @@
 				}
 				else {
-					xfree((void**)&bufferc);
+					if (pncom && ppcom) {
+						(*pncom)++;
+						*ppcom=(char **) xrealloc(*ppcom,*pncom*sizeof(char*));
+						(*ppcom)[*pncom-1]=bufferc;
+					}
+					else
+						xfree((void**)&bufferc);
 					inew=1;
 					continue;
@@ -83,5 +90,5 @@
 		/*  accumulate field, including newlines  */
 		else if (ifield) {
-			/*  distinguish between closing tag or comment  */
+			/*  distinguish between another tag or comment  */
 			if (c == '<') {
 				ungetc(c,fid);
@@ -89,5 +96,11 @@
 					break;
 				else
-					xfree((void**)&bufferc);
+					if (pncom && ppcom) {
+						(*pncom)++;
+						*ppcom=(char **) xrealloc(*ppcom,*pncom*sizeof(char*));
+						(*ppcom)[*pncom-1]=bufferc;
+					}
+					else
+						xfree((void**)&bufferc);
 			}
 			else {
@@ -275,5 +288,6 @@
 /*  get next token and convert to appropriate format  */
 
-	if (!(kstr=KMLFileToken(fid)) ||
+	if (!(kstr=KMLFileToken(fid,
+							NULL,NULL)) ||
 		(kstr[0] == '<'))
 		_error_("KMLFileTokenParse -- Missing integer field for %s.\n",ktag);
@@ -285,5 +299,6 @@
 
 	if (ktag)
-		if (!(kstr=KMLFileToken(fid)) ||
+		if (!(kstr=KMLFileToken(fid,
+								NULL,NULL)) ||
 			(kstr[0] != '<') ||
 			(kstr[1] != '/') ||
@@ -309,5 +324,6 @@
 /*  get next token and convert to appropriate format  */
 
-	if (!(kstr=KMLFileToken(fid)) ||
+	if (!(kstr=KMLFileToken(fid,
+							NULL,NULL)) ||
 		(kstr[0] == '<'))
 		_error_("KMLFileTokenParse -- Missing bool field for %s.\n",ktag);
@@ -320,5 +336,6 @@
 
 	if (ktag)
-		if (!(kstr=KMLFileToken(fid)) ||
+		if (!(kstr=KMLFileToken(fid,
+								NULL,NULL)) ||
 			(kstr[0] != '<') ||
 			(kstr[1] != '/') ||
@@ -344,5 +361,6 @@
 /*  get next token and allocate if necessary  */
 
-	if (!(kstr=KMLFileToken(fid)) ||
+	if (!(kstr=KMLFileToken(fid,
+							NULL,NULL)) ||
 		(kstr[0] == '<'))
 		_error_("KMLFileTokenParse -- Missing string field for %s.\n",ktag);
@@ -372,5 +390,6 @@
 
 	if (ktag)
-		if (!(kstr=KMLFileToken(fid)) ||
+		if (!(kstr=KMLFileToken(fid,
+								NULL,NULL)) ||
 			(kstr[0] != '<') ||
 			(kstr[1] != '/') ||
@@ -395,5 +414,6 @@
 /*  get next token and convert to appropriate format  */
 
-	if (!(kstr=KMLFileToken(fid)) ||
+	if (!(kstr=KMLFileToken(fid,
+							NULL,NULL)) ||
 		(kstr[0] == '<'))
 		_error_("KMLFileTokenParse -- Missing integer field for %s.\n",ktag);
@@ -405,5 +425,6 @@
 
 	if (ktag)
-		if (!(kstr=KMLFileToken(fid)) ||
+		if (!(kstr=KMLFileToken(fid,
+								NULL,NULL)) ||
 			(kstr[0] != '<') ||
 			(kstr[1] != '/') ||
@@ -428,5 +449,6 @@
 /*  get next token and convert to appropriate format  */
 
-	if (!(kstr=KMLFileToken(fid)) ||
+	if (!(kstr=KMLFileToken(fid,
+							NULL,NULL)) ||
 		(kstr[0] == '<'))
 		_error_("KMLFileTokenParse -- Missing integer field for %s.\n",ktag);
@@ -438,5 +460,6 @@
 
 	if (ktag)
-		if (!(kstr=KMLFileToken(fid)) ||
+		if (!(kstr=KMLFileToken(fid,
+								NULL,NULL)) ||
 			(kstr[0] != '<') ||
 			(kstr[1] != '/') ||
@@ -464,5 +487,6 @@
 /*  get next token and allocate if necessary  */
 
-	if (!(kstr=KMLFileToken(fid)) ||
+	if (!(kstr=KMLFileToken(fid,
+							NULL,NULL)) ||
 		(kstr[0] == '<'))
 		_error_("KMLFileTokenParse -- Missing double [m] field for %s.\n",ktag);
@@ -495,5 +519,6 @@
 
 	if (ktag)
-		if (!(kstr=KMLFileToken(fid)) ||
+		if (!(kstr=KMLFileToken(fid,
+								NULL,NULL)) ||
 			(kstr[0] != '<') ||
 			(kstr[1] != '/') ||
@@ -523,5 +548,6 @@
 /*  get next token and allocate if necessary  */
 
-	if (!(kstr=KMLFileToken(fid)) ||
+	if (!(kstr=KMLFileToken(fid,
+							NULL,NULL)) ||
 		(kstr[0] == '<'))
 		_error_("KMLFileTokenParse -- Missing double [m x 3] field for %s.\n",ktag);
@@ -561,5 +587,6 @@
 
 	if (ktag)
-		if (!(kstr=KMLFileToken(fid)) ||
+		if (!(kstr=KMLFileToken(fid,
+								NULL,NULL)) ||
 			(kstr[0] != '<') ||
 			(kstr[1] != '/') ||
@@ -590,5 +617,6 @@
 /*  if next token is a closing tag, compare to input  */
 
-	while (kstr=KMLFileToken(fid)) {
+	while (kstr=KMLFileToken(fid,
+							 NULL,NULL)) {
 		if      ((kstr[0] == '<') &&
 				 (kstr[1] == '/') &&
Index: /issm/trunk/src/c/objects/KML/KMLFileReadUtils.h
===================================================================
--- /issm/trunk/src/c/objects/KML/KMLFileReadUtils.h	(revision 10839)
+++ /issm/trunk/src/c/objects/KML/KMLFileReadUtils.h	(revision 10840)
@@ -15,5 +15,6 @@
 
 /* local prototypes: */
-char* KMLFileToken(FILE* fid);
+char* KMLFileToken(FILE* fid,
+				   int* pncom,char*** ppcom);
 char* KMLFileTokenComment(FILE* fid);
 void KMLFileTokenBuffer(char** pbuffer,int* pibuf,int* pbuflen,
Index: /issm/trunk/src/c/objects/KML/KML_Comment.cpp
===================================================================
--- /issm/trunk/src/c/objects/KML/KML_Comment.cpp	(revision 10840)
+++ /issm/trunk/src/c/objects/KML/KML_Comment.cpp	(revision 10840)
@@ -0,0 +1,126 @@
+/*!\file KML_Comment.cpp
+ * \brief: implementation of the kml_comment object
+ */
+
+/*Headers:*/
+/*{{{1*/
+#ifdef HAVE_CONFIG_H
+	#include <config.h>
+#else
+#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
+#endif
+
+#include <stdio.h>
+#include <string.h>
+#include "../objects.h"
+#include "../../shared/shared.h"
+#include "../../io/io.h"
+#include "../../Container/Container.h"
+#include "../../include/include.h"
+/*}}}*/
+
+/*Constructors/destructor/copy*/
+/*FUNCTION KML_Comment::KML_Comment(){{{1*/
+KML_Comment::KML_Comment(){
+
+	value     =NULL;
+
+}
+/*}}}*/
+/*FUNCTION KML_Comment::~KML_Comment(){{{1*/
+KML_Comment::~KML_Comment(){
+
+	if (value     ) xfree((void**)&value);
+
+}
+/*}}}*/
+
+/*Other*/
+/*FUNCTION KML_Comment::Echo {{{1*/
+void  KML_Comment::Echo(){
+
+	bool  flag=true;
+
+	_printf_(flag,"    ");
+	_printf_(flag,"%s\n",value);
+
+	return;
+}
+/*}}}*/
+
+/*FUNCTION KML_Comment::DeepEcho {{{1*/
+void  KML_Comment::DeepEcho(){
+
+	char  indent[81]="";
+
+	KML_Comment::DeepEcho(indent);
+
+	return;
+}
+/*}}}*/
+
+/*FUNCTION KML_Comment::DeepEcho {{{1*/
+void  KML_Comment::DeepEcho(char* indent){
+
+	bool  flag=true;
+
+	_printf_(flag,"%s    ",indent);
+	_printf_(flag,"%s\n",value);
+
+	return;
+}
+/*}}}*/
+
+/*FUNCTION KML_Comment::Write {{{1*/
+void  KML_Comment::Write(FILE* filout,char* indent){
+
+	if (strncmp(&value[0]              ,"<!--",4))
+		fprintf(filout,"%s<!--\n",indent);
+	fprintf(filout,"%s  %s\n",indent,value);
+	if (strncmp(&value[strlen(value)-3],"-->" ,3))
+		fprintf(filout,"%s-->\n",indent);
+
+	return;
+}
+/*}}}*/
+
+/*FUNCTION KML_Comment::Read {{{1*/
+void  KML_Comment::Read(FILE* fid,char* kstr){
+
+//  comments always read as part of KMLFileToken
+
+	;
+
+	return;
+}
+/*}}}*/
+
+/*FUNCTION KML_Comment::Alloc {{{1*/
+void  KML_Comment::Alloc(char* valuei){
+
+	value=(char *) xmalloc((strlen(valuei)+1)*sizeof(char));
+	memcpy(value,valuei,(strlen(valuei)+1)*sizeof(char));
+
+	return;
+}
+/*}}}*/
+
+/*FUNCTION KML_Comment::Add {{{1*/
+void  KML_Comment::Add(DataSet* commnt){
+
+	commnt->AddObject((Object*)this);
+
+	return;
+}
+/*}}}*/
+
+/*FUNCTION KML_Comment::Get {{{1*/
+void  KML_Comment::Get(char** pvalueo){
+
+	*pvalueo=(char *) xmalloc((strlen(value)+1)*sizeof(char));
+	memcpy(*pvalueo,value,(strlen(value)+1)*sizeof(char));
+
+	return;
+}
+/*}}}*/
+
Index: /issm/trunk/src/c/objects/KML/KML_Comment.h
===================================================================
--- /issm/trunk/src/c/objects/KML/KML_Comment.h	(revision 10840)
+++ /issm/trunk/src/c/objects/KML/KML_Comment.h	(revision 10840)
@@ -0,0 +1,50 @@
+/*! \file KML_Comment.h 
+ *  \brief: header file for kml_comment object
+ */
+
+#ifndef _KML_COMMENT_H_
+#define _KML_COMMENT_H_
+
+/*Headers:{{{1*/
+#include "../../include/include.h"
+#include "../../shared/Exceptions/exceptions.h"
+#include "../../EnumDefinitions/EnumDefinitions.h"
+
+#include "../Object.h"
+class DataSet;
+/*}}}*/
+
+class KML_Comment: public Object {
+
+	public:
+
+		char* name;
+		char* value;
+
+		/*KML_Comment constructors, destructors {{{1*/
+		KML_Comment();
+		~KML_Comment();
+		/*}}}*/
+		/*Object virtual functions definitions:{{{1*/
+		virtual void  Echo();
+		virtual void  DeepEcho();
+		virtual void  DeepEcho(char* indent);
+		int   Id(){_error_("Not implemented yet.");};
+		int   MyRank(){_error_("Not implemented yet.");};
+		void  Marshall(char** pmarshalled_dataset){_error_("Not implemented yet.");};
+		int   MarshallSize(){_error_("Not implemented yet.");};
+		void  Demarshall(char** pmarshalled_dataset){_error_("Not implemented yet.");};
+		int   ObjectEnum(){_error_("Not implemented yet.");};
+		Object* copy(){_error_("Not implemented yet.");};
+		/*}}}*/
+
+		/*virtual functions: */
+		void  Write(FILE* fid,char* indent);
+		void  Read(FILE* fid,char* kstr);
+		void  Alloc(char* valuei);
+		void  Add(DataSet* commnt);
+		void  Get(char** pvalueo);
+
+};
+#endif  /* _KML_COMMENT_H */
+
Index: /issm/trunk/src/c/objects/KML/KML_Document.cpp
===================================================================
--- /issm/trunk/src/c/objects/KML/KML_Document.cpp	(revision 10839)
+++ /issm/trunk/src/c/objects/KML/KML_Document.cpp	(revision 10840)
@@ -78,4 +78,5 @@
 	WriteAttrib(filout," ");
 	fprintf(filout,">\n");
+	WriteCommnt(filout,indent);
 
 	KML_Container::Write(filout,indent);
@@ -91,4 +92,6 @@
 
 	char*        kstri;
+	int          ncom=0;
+	char**       pcom=NULL;
 
 /*  get object attributes and check for solo tag  */
@@ -100,5 +103,6 @@
 /*  loop over and process fields within opening and closing tags  */
 
-	while (kstri=KMLFileToken(fid)) {
+	while (kstri=KMLFileToken(fid,
+							  &ncom,&pcom)) {
 		if      (!strncmp(kstri,"</Document",10)) {
 			xfree((void**)&kstri);
@@ -116,4 +120,10 @@
 	}
 
+	this->AddCommnt(ncom,pcom);
+
+	for (ncom; ncom>0; ncom--)
+		xfree((void**)&(pcom[ncom-1]));
+	xfree((void**)&pcom);
+
 	return;
 }
Index: /issm/trunk/src/c/objects/KML/KML_File.cpp
===================================================================
--- /issm/trunk/src/c/objects/KML/KML_File.cpp	(revision 10839)
+++ /issm/trunk/src/c/objects/KML/KML_File.cpp	(revision 10840)
@@ -103,4 +103,5 @@
 	WriteAttrib(filout," ");
 	fprintf(filout,">\n");
+	WriteCommnt(filout,indent);
 
 	KML_Object::Write(filout,indent);
@@ -125,4 +126,6 @@
 
 	char*        kstri;
+	int          ncom=0;
+	char**       pcom=NULL;
 	KML_Object*  kobj;
 
@@ -135,5 +138,6 @@
 /*  loop over and process fields within opening and closing tags  */
 
-	while (kstri=KMLFileToken(fid)) {
+	while (kstri=KMLFileToken(fid,
+							  &ncom,&pcom)) {
 		if      (!strncmp(kstri,"</kml", 5)) {
 			xfree((void**)&kstri);
@@ -253,4 +257,10 @@
 	}
 
+	this->AddCommnt(ncom,pcom);
+
+	for (ncom; ncom>0; ncom--)
+		xfree((void**)&(pcom[ncom-1]));
+	xfree((void**)&pcom);
+
 	return;
 }
Index: /issm/trunk/src/c/objects/KML/KML_Folder.cpp
===================================================================
--- /issm/trunk/src/c/objects/KML/KML_Folder.cpp	(revision 10839)
+++ /issm/trunk/src/c/objects/KML/KML_Folder.cpp	(revision 10840)
@@ -78,4 +78,5 @@
 	WriteAttrib(filout," ");
 	fprintf(filout,">\n");
+	WriteCommnt(filout,indent);
 
 	KML_Container::Write(filout,indent);
@@ -91,4 +92,6 @@
 
 	char*        kstri;
+	int          ncom=0;
+	char**       pcom=NULL;
 
 /*  get object attributes and check for solo tag  */
@@ -100,5 +103,6 @@
 /*  loop over and process fields within opening and closing tags  */
 
-	while (kstri=KMLFileToken(fid)) {
+	while (kstri=KMLFileToken(fid,
+							  &ncom,&pcom)) {
 		if      (!strncmp(kstri,"</Folder", 8)) {
 			xfree((void**)&kstri);
@@ -116,4 +120,10 @@
 	}
 
+	this->AddCommnt(ncom,pcom);
+
+	for (ncom; ncom>0; ncom--)
+		xfree((void**)&(pcom[ncom-1]));
+	xfree((void**)&pcom);
+
 	return;
 }
Index: /issm/trunk/src/c/objects/KML/KML_GroundOverlay.cpp
===================================================================
--- /issm/trunk/src/c/objects/KML/KML_GroundOverlay.cpp	(revision 10839)
+++ /issm/trunk/src/c/objects/KML/KML_GroundOverlay.cpp	(revision 10840)
@@ -102,4 +102,5 @@
 	WriteAttrib(filout," ");
 	fprintf(filout,">\n");
+	WriteCommnt(filout,indent);
 
 	KML_Overlay::Write(filout,indent);
@@ -124,4 +125,6 @@
 
 	char*        kstri;
+	int          ncom=0;
+	char**       pcom=NULL;
 
 /*  get object attributes and check for solo tag  */
@@ -133,5 +136,6 @@
 /*  loop over and process fields within opening and closing tags  */
 
-	while (kstri=KMLFileToken(fid)) {
+	while (kstri=KMLFileToken(fid,
+							  &ncom,&pcom)) {
 		if      (!strncmp(kstri,"</GroundOverlay",15)) {
 			xfree((void**)&kstri);
@@ -162,4 +166,10 @@
 	}
 
+	this->AddCommnt(ncom,pcom);
+
+	for (ncom; ncom>0; ncom--)
+		xfree((void**)&(pcom[ncom-1]));
+	xfree((void**)&pcom);
+
 	return;
 }
Index: /issm/trunk/src/c/objects/KML/KML_Icon.cpp
===================================================================
--- /issm/trunk/src/c/objects/KML/KML_Icon.cpp	(revision 10839)
+++ /issm/trunk/src/c/objects/KML/KML_Icon.cpp	(revision 10840)
@@ -103,4 +103,5 @@
 	WriteAttrib(filout," ");
 	fprintf(filout,">\n");
+	WriteCommnt(filout,indent);
 
 	KML_Object::Write(filout,indent);
@@ -130,4 +131,6 @@
 
 	char*        kstri;
+	int          ncom=0;
+	char**       pcom=NULL;
 
 /*  get object attributes and check for solo tag  */
@@ -139,5 +142,6 @@
 /*  loop over and process fields within opening and closing tags  */
 
-	while (kstri=KMLFileToken(fid)) {
+	while (kstri=KMLFileToken(fid,
+							  &ncom,&pcom)) {
 		if      (!strncmp(kstri,"</Icon", 6)) {
 			xfree((void**)&kstri);
@@ -188,6 +192,12 @@
 	}
 
-	return;
-}
-/*}}}*/
-
+	this->AddCommnt(ncom,pcom);
+
+	for (ncom; ncom>0; ncom--)
+		xfree((void**)&(pcom[ncom-1]));
+	xfree((void**)&pcom);
+
+	return;
+}
+/*}}}*/
+
Index: /issm/trunk/src/c/objects/KML/KML_LatLonBox.cpp
===================================================================
--- /issm/trunk/src/c/objects/KML/KML_LatLonBox.cpp	(revision 10839)
+++ /issm/trunk/src/c/objects/KML/KML_LatLonBox.cpp	(revision 10840)
@@ -94,4 +94,5 @@
 	WriteAttrib(filout," ");
 	fprintf(filout,">\n");
+	WriteCommnt(filout,indent);
 
 	KML_Object::Write(filout,indent);
@@ -113,4 +114,6 @@
 
 	char*        kstri;
+	int          ncom=0;
+	char**       pcom=NULL;
 
 /*  get object attributes and check for solo tag  */
@@ -122,5 +125,6 @@
 /*  loop over and process fields within opening and closing tags  */
 
-	while (kstri=KMLFileToken(fid)) {
+	while (kstri=KMLFileToken(fid,
+							  &ncom,&pcom)) {
 		if      (!strncmp(kstri,"</LatLonBox",11)) {
 			xfree((void**)&kstri);
@@ -159,4 +163,10 @@
 	}
 
+	this->AddCommnt(ncom,pcom);
+
+	for (ncom; ncom>0; ncom--)
+		xfree((void**)&(pcom[ncom-1]));
+	xfree((void**)&pcom);
+
 	return;
 }
Index: /issm/trunk/src/c/objects/KML/KML_LineString.cpp
===================================================================
--- /issm/trunk/src/c/objects/KML/KML_LineString.cpp	(revision 10839)
+++ /issm/trunk/src/c/objects/KML/KML_LineString.cpp	(revision 10840)
@@ -103,4 +103,5 @@
 	WriteAttrib(filout," ");
 	fprintf(filout,">\n");
+	WriteCommnt(filout,indent);
 
 	KML_Geometry::Write(filout,indent);
@@ -128,4 +129,6 @@
 
 	char*        kstri;
+	int          ncom=0;
+	char**       pcom=NULL;
 
 /*  get object attributes and check for solo tag  */
@@ -137,5 +140,6 @@
 /*  loop over and process fields within opening and closing tags  */
 
-	while (kstri=KMLFileToken(fid)) {
+	while (kstri=KMLFileToken(fid,
+							  &ncom,&pcom)) {
 		if      (!strncmp(kstri,"</LineString",12)) {
 			xfree((void**)&kstri);
@@ -170,4 +174,10 @@
 	}
 
+	this->AddCommnt(ncom,pcom);
+
+	for (ncom; ncom>0; ncom--)
+		xfree((void**)&(pcom[ncom-1]));
+	xfree((void**)&pcom);
+
 	return;
 }
Index: /issm/trunk/src/c/objects/KML/KML_LineStyle.cpp
===================================================================
--- /issm/trunk/src/c/objects/KML/KML_LineStyle.cpp	(revision 10839)
+++ /issm/trunk/src/c/objects/KML/KML_LineStyle.cpp	(revision 10840)
@@ -83,4 +83,5 @@
 	WriteAttrib(filout," ");
 	fprintf(filout,">\n");
+	WriteCommnt(filout,indent);
 
 	KML_ColorStyle::Write(filout,indent);
@@ -98,4 +99,6 @@
 
 	char*        kstri;
+	int          ncom=0;
+	char**       pcom=NULL;
 
 /*  get object attributes and check for solo tag  */
@@ -107,5 +110,6 @@
 /*  loop over and process fields within opening and closing tags  */
 
-	while (kstri=KMLFileToken(fid)) {
+	while (kstri=KMLFileToken(fid,
+							  &ncom,&pcom)) {
 		if      (!strncmp(kstri,"</LineStyle",11)) {
 			xfree((void**)&kstri);
@@ -128,4 +132,10 @@
 	}
 
+	this->AddCommnt(ncom,pcom);
+
+	for (ncom; ncom>0; ncom--)
+		xfree((void**)&(pcom[ncom-1]));
+	xfree((void**)&pcom);
+
 	return;
 }
Index: /issm/trunk/src/c/objects/KML/KML_LinearRing.cpp
===================================================================
--- /issm/trunk/src/c/objects/KML/KML_LinearRing.cpp	(revision 10839)
+++ /issm/trunk/src/c/objects/KML/KML_LinearRing.cpp	(revision 10840)
@@ -103,4 +103,5 @@
 	WriteAttrib(filout," ");
 	fprintf(filout,">\n");
+	WriteCommnt(filout,indent);
 
 	KML_Geometry::Write(filout,indent);
@@ -128,4 +129,6 @@
 
 	char*        kstri;
+	int          ncom=0;
+	char**       pcom=NULL;
 
 /*  get object attributes and check for solo tag  */
@@ -137,5 +140,6 @@
 /*  loop over and process fields within opening and closing tags  */
 
-	while (kstri=KMLFileToken(fid)) {
+	while (kstri=KMLFileToken(fid,
+							  &ncom,&pcom)) {
 		if      (!strncmp(kstri,"</LinearRing",12)) {
 			xfree((void**)&kstri);
@@ -169,4 +173,10 @@
 		xfree((void**)&kstri);
 	}
+
+	this->AddCommnt(ncom,pcom);
+
+	for (ncom; ncom>0; ncom--)
+		xfree((void**)&(pcom[ncom-1]));
+	xfree((void**)&pcom);
 
 	return;
Index: /issm/trunk/src/c/objects/KML/KML_MultiGeometry.cpp
===================================================================
--- /issm/trunk/src/c/objects/KML/KML_MultiGeometry.cpp	(revision 10839)
+++ /issm/trunk/src/c/objects/KML/KML_MultiGeometry.cpp	(revision 10840)
@@ -103,4 +103,5 @@
 	WriteAttrib(filout," ");
 	fprintf(filout,">\n");
+	WriteCommnt(filout,indent);
 
 	KML_Geometry::Write(filout,indent);
@@ -125,4 +126,6 @@
 
 	char*        kstri;
+	int          ncom=0;
+	char**       pcom=NULL;
 	KML_Object*  kobj;
 
@@ -135,5 +138,6 @@
 /*  loop over and process fields within opening and closing tags  */
 
-	while (kstri=KMLFileToken(fid)) {
+	while (kstri=KMLFileToken(fid,
+							  &ncom,&pcom)) {
 		if      (!strncmp(kstri,"</MultiGeometry",15)) {
 			xfree((void**)&kstri);
@@ -181,4 +185,10 @@
 	}
 
+	this->AddCommnt(ncom,pcom);
+
+	for (ncom; ncom>0; ncom--)
+		xfree((void**)&(pcom[ncom-1]));
+	xfree((void**)&pcom);
+
 	return;
 }
Index: /issm/trunk/src/c/objects/KML/KML_Object.cpp
===================================================================
--- /issm/trunk/src/c/objects/KML/KML_Object.cpp	(revision 10839)
+++ /issm/trunk/src/c/objects/KML/KML_Object.cpp	(revision 10840)
@@ -25,4 +25,5 @@
 
 	attrib    =new DataSet;
+	commnt    =new DataSet;
 
 }
@@ -35,4 +36,8 @@
 		attrib    =NULL;
 	}
+	if (commnt) {
+		delete commnt;
+		commnt    =NULL;
+	}
 
 }
@@ -46,4 +51,5 @@
 
 	_printf_(flag,"        attrib: (size=%d)\n" ,attrib->Size());
+	_printf_(flag,"        commnt: (size=%d)\n" ,commnt->Size());
 
 	return;
@@ -77,4 +83,13 @@
 		_printf_(flag,"%s        attrib: [empty]\n"    ,indent);
 
+/*  loop over the comments for the object  */
+
+	if (commnt->Size())
+		for (i=0; i<commnt->Size(); i++) {
+			((KML_Comment *)commnt->GetObjectByOffset(i))->DeepEcho(indent);
+		}
+	else
+		_printf_(flag,"%s        commnt: [empty]\n"    ,indent);
+
 	return;
 }
@@ -85,4 +100,5 @@
 
 //  attributes always written in keyword line of derived classes
+//  comments always written after keyword line of derived classes
 
 	;
@@ -158,5 +174,4 @@
 		*pvalue=(char *) xmalloc((strlen(deflt)+1)*sizeof(char));
 		memcpy(*pvalue,deflt,(strlen(deflt)+1)*sizeof(char));
-
 	}
 
@@ -182,2 +197,67 @@
 /*}}}*/
 
+/*FUNCTION KML_Object::AddCommnt {{{1*/
+void  KML_Object::AddCommnt(int ncom,char** pcom){
+
+	int   i;
+	KML_Comment* kcom=NULL;
+
+	for (i=0; i<ncom; i++) {
+		kcom=new KML_Comment();
+		kcom->Alloc(pcom[i]);
+		kcom->Add(commnt);
+	}
+
+	return;
+}
+/*}}}*/
+
+/*FUNCTION KML_Object::AddCommnt {{{1*/
+void  KML_Object::AddCommnt(char* value){
+
+	KML_Comment* kcom=NULL;
+
+	kcom=new KML_Comment();
+	kcom->Alloc(value);
+	kcom->Add(commnt);
+
+	return;
+}
+/*}}}*/
+
+/*FUNCTION KML_Object::FindCommnt {{{1*/
+void  KML_Object::FindCommnt(char** pvalue,int inum){
+
+	KML_Comment* kcom=NULL;
+
+/*  loop over any comments for the object  */
+
+	if (inum <= commnt->Size())
+		kcom=(KML_Comment *)commnt->GetObjectByOffset(inum-1);
+
+/*  if found, get the value; otherwise use the NULL  */
+
+	if (kcom)
+		kcom->Get(pvalue);
+
+	return;
+}
+/*}}}*/
+
+/*FUNCTION KML_Object::WriteCommnt {{{1*/
+void  KML_Object::WriteCommnt(FILE* filout,char* indent){
+
+	int   i;
+
+//  comments always written after keyword line of kml_object
+
+/*  loop over any comments for the object  */
+
+	if (commnt->Size())
+		for (i=0; i<commnt->Size(); i++)
+			((KML_Comment *)commnt->GetObjectByOffset(i))->Write(filout,indent);
+
+	return;
+}
+/*}}}*/
+
Index: /issm/trunk/src/c/objects/KML/KML_Object.h
===================================================================
--- /issm/trunk/src/c/objects/KML/KML_Object.h	(revision 10839)
+++ /issm/trunk/src/c/objects/KML/KML_Object.h	(revision 10840)
@@ -20,4 +20,5 @@
 
 		DataSet* attrib;
+		DataSet* commnt;
 
 		/*KML_Object constructors, destructors {{{1*/
@@ -45,4 +46,8 @@
 		virtual void  FindAttrib(char** pvalue,char* name,char* deflt);
 		virtual void  WriteAttrib(FILE* fid,char* indent);
+		virtual void  AddCommnt(int ncom,char** pcom);
+		virtual void  AddCommnt(char* value);
+		virtual void  FindCommnt(char** pvalue,int inum);
+		virtual void  WriteCommnt(FILE* fid,char* indent);
 
 };
Index: /issm/trunk/src/c/objects/KML/KML_Placemark.cpp
===================================================================
--- /issm/trunk/src/c/objects/KML/KML_Placemark.cpp	(revision 10839)
+++ /issm/trunk/src/c/objects/KML/KML_Placemark.cpp	(revision 10840)
@@ -103,4 +103,5 @@
 	WriteAttrib(filout," ");
 	fprintf(filout,">\n");
+	WriteCommnt(filout,indent);
 
 	KML_Feature::Write(filout,indent);
@@ -125,4 +126,6 @@
 
 	char*        kstri;
+	int          ncom=0;
+	char**       pcom=NULL;
 	KML_Object*  kobj;
 
@@ -135,5 +138,6 @@
 /*  loop over and process fields within opening and closing tags  */
 
-	while (kstri=KMLFileToken(fid)) {
+	while (kstri=KMLFileToken(fid,
+							  &ncom,&pcom)) {
 		if      (!strncmp(kstri,"</Placemark",11)) {
 			xfree((void**)&kstri);
@@ -180,4 +184,10 @@
 		xfree((void**)&kstri);
 	}
+
+	this->AddCommnt(ncom,pcom);
+
+	for (ncom; ncom>0; ncom--)
+		xfree((void**)&(pcom[ncom-1]));
+	xfree((void**)&pcom);
 
 	return;
Index: /issm/trunk/src/c/objects/KML/KML_Point.cpp
===================================================================
--- /issm/trunk/src/c/objects/KML/KML_Point.cpp	(revision 10839)
+++ /issm/trunk/src/c/objects/KML/KML_Point.cpp	(revision 10840)
@@ -92,4 +92,5 @@
 	WriteAttrib(filout," ");
 	fprintf(filout,">\n");
+	WriteCommnt(filout,indent);
 
 	KML_Geometry::Write(filout,indent);
@@ -111,4 +112,6 @@
 	double*      pcoords=&coords[0];
 	char*        kstri;
+	int          ncom=0;
+	char**       pcom=NULL;
 
 /*  get object attributes and check for solo tag  */
@@ -120,5 +123,6 @@
 /*  loop over and process fields within opening and closing tags  */
 
-	while (kstri=KMLFileToken(fid)) {
+	while (kstri=KMLFileToken(fid,
+							  &ncom,&pcom)) {
 		if      (!strncmp(kstri,"</Point", 7)) {
 			xfree((void**)&kstri);
@@ -149,4 +153,10 @@
 	}
 
+	this->AddCommnt(ncom,pcom);
+
+	for (ncom; ncom>0; ncom--)
+		xfree((void**)&(pcom[ncom-1]));
+	xfree((void**)&pcom);
+
 	return;
 }
Index: /issm/trunk/src/c/objects/KML/KML_PolyStyle.cpp
===================================================================
--- /issm/trunk/src/c/objects/KML/KML_PolyStyle.cpp	(revision 10839)
+++ /issm/trunk/src/c/objects/KML/KML_PolyStyle.cpp	(revision 10840)
@@ -86,4 +86,5 @@
 	WriteAttrib(filout," ");
 	fprintf(filout,">\n");
+	WriteCommnt(filout,indent);
 
 	KML_ColorStyle::Write(filout,indent);
@@ -102,4 +103,6 @@
 
 	char*        kstri;
+	int          ncom=0;
+	char**       pcom=NULL;
 
 /*  get object attributes and check for solo tag  */
@@ -111,5 +114,6 @@
 /*  loop over and process fields within opening and closing tags  */
 
-	while (kstri=KMLFileToken(fid)) {
+	while (kstri=KMLFileToken(fid,
+							  &ncom,&pcom)) {
 		if      (!strncmp(kstri,"</PolyStyle",11)) {
 			xfree((void**)&kstri);
@@ -136,4 +140,10 @@
 	}
 
+	this->AddCommnt(ncom,pcom);
+
+	for (ncom; ncom>0; ncom--)
+		xfree((void**)&(pcom[ncom-1]));
+	xfree((void**)&pcom);
+
 	return;
 }
Index: /issm/trunk/src/c/objects/KML/KML_Polygon.cpp
===================================================================
--- /issm/trunk/src/c/objects/KML/KML_Polygon.cpp	(revision 10839)
+++ /issm/trunk/src/c/objects/KML/KML_Polygon.cpp	(revision 10840)
@@ -128,4 +128,5 @@
 	WriteAttrib(filout," ");
 	fprintf(filout,">\n");
+	WriteCommnt(filout,indent);
 
 	KML_Geometry::Write(filout,indent);
@@ -165,4 +166,6 @@
 	char*        kstri;
 	char*        kstrj;
+	int          ncom=0;
+	char**       pcom=NULL;
 	KML_Object*  kobj;
 
@@ -175,5 +178,6 @@
 /*  loop over and process fields within opening and closing tags  */
 
-	while (kstri=KMLFileToken(fid)) {
+	while (kstri=KMLFileToken(fid,
+							  &ncom,&pcom)) {
 		if      (!strncmp(kstri,"</Polygon", 9)) {
 			xfree((void**)&kstri);
@@ -202,5 +206,6 @@
 /*  loop over and process fields within outer boundary  */
 
-			while (kstrj=KMLFileToken(fid)) {
+			while (kstrj=KMLFileToken(fid,
+									  &ncom,&pcom)) {
 				if      (!strncmp(kstrj,"</outerBoundaryIs",17)) {
 					xfree((void**)&kstrj);
@@ -228,5 +233,6 @@
 /*  loop over and process fields within inner boundaries  */
 
-			while (kstrj=KMLFileToken(fid)) {
+			while (kstrj=KMLFileToken(fid,
+									  &ncom,&pcom)) {
 				if      (!strncmp(kstrj,"</innerBoundaryIs",17)) {
 					xfree((void**)&kstrj);
@@ -257,4 +263,10 @@
 	}
 
+	this->AddCommnt(ncom,pcom);
+
+	for (ncom; ncom>0; ncom--)
+		xfree((void**)&(pcom[ncom-1]));
+	xfree((void**)&pcom);
+
 	return;
 }
Index: /issm/trunk/src/c/objects/KML/KML_Style.cpp
===================================================================
--- /issm/trunk/src/c/objects/KML/KML_Style.cpp	(revision 10839)
+++ /issm/trunk/src/c/objects/KML/KML_Style.cpp	(revision 10840)
@@ -149,4 +149,5 @@
 	WriteAttrib(filout," ");
 	fprintf(filout,">\n");
+	WriteCommnt(filout,indent);
 
 	KML_StyleSelector::Write(filout,indent);
@@ -179,4 +180,6 @@
 
 	char*        kstri;
+	int          ncom=0;
+	char**       pcom=NULL;
 
 /*  get object attributes and check for solo tag  */
@@ -188,5 +191,6 @@
 /*  loop over and process fields within opening and closing tags  */
 
-	while (kstri=KMLFileToken(fid)) {
+	while (kstri=KMLFileToken(fid,
+							  &ncom,&pcom)) {
 		if      (!strncmp(kstri,"</Style", 7)) {
 			xfree((void**)&kstri);
@@ -234,6 +238,12 @@
 	}
 
-	return;
-}
-/*}}}*/
-
+	this->AddCommnt(ncom,pcom);
+
+	for (ncom; ncom>0; ncom--)
+		xfree((void**)&(pcom[ncom-1]));
+	xfree((void**)&pcom);
+
+	return;
+}
+/*}}}*/
+
Index: /issm/trunk/src/c/objects/objects.h
===================================================================
--- /issm/trunk/src/c/objects/objects.h	(revision 10839)
+++ /issm/trunk/src/c/objects/objects.h	(revision 10840)
@@ -48,4 +48,5 @@
 /*KML parsing objects: */
 #include "./KML/KML_Attribute.h"
+#include "./KML/KML_Comment.h"
 #include "./KML/KML_ColorStyle.h"
 #include "./KML/KML_Container.h"
