Index: /issm/trunk/src/c/Makefile.am
===================================================================
--- /issm/trunk/src/c/Makefile.am	(revision 8460)
+++ /issm/trunk/src/c/Makefile.am	(revision 8461)
@@ -77,4 +77,6 @@
 					./objects/Bamg/Mesh.cpp\
 					./objects/Bamg/Mesh.h\
+					./objects/KML/KML_Attribute.cpp\
+					./objects/KML/KML_Attribute.h\
 					./objects/KML/KML_ColorStyle.cpp\
 					./objects/KML/KML_ColorStyle.h\
@@ -508,4 +510,6 @@
 					./modules/MinVzx/MinVzx.h\
 					./modules/MinVzx/MinVzx.cpp\
+					./modules/KMLMeshWritex/KMLFileReadx.h\
+					./modules/KMLMeshWritex/KMLFileReadx.cpp\
 					./modules/KMLMeshWritex/KMLMeshWritex.h\
 					./modules/KMLMeshWritex/KMLMeshWritex.cpp\
@@ -730,4 +734,6 @@
 					./objects/Gauss/GaussPenta.h\
 					./objects/Gauss/GaussPenta.cpp\
+					./objects/KML/KML_Attribute.cpp\
+					./objects/KML/KML_Attribute.h\
 					./objects/KML/KML_ColorStyle.cpp\
 					./objects/KML/KML_ColorStyle.h\
@@ -1149,4 +1155,6 @@
 					./modules/MinVzx/MinVzx.h\
 					./modules/MinVzx/MinVzx.cpp\
+					./modules/KMLMeshWritex/KMLFileReadx.h\
+					./modules/KMLMeshWritex/KMLFileReadx.cpp\
 					./modules/KMLMeshWritex/KMLMeshWritex.h\
 					./modules/KMLMeshWritex/KMLMeshWritex.cpp\
Index: /issm/trunk/src/c/modules/KMLMeshWritex/KMLFileReadx.cpp
===================================================================
--- /issm/trunk/src/c/modules/KMLMeshWritex/KMLFileReadx.cpp	(revision 8461)
+++ /issm/trunk/src/c/modules/KMLMeshWritex/KMLFileReadx.cpp	(revision 8461)
@@ -0,0 +1,76 @@
+/*!\file KMLFileReadx.cpp
+ */
+
+#include "./KMLFileReadx.h"
+#include "../../shared/shared.h"
+#include "../../include/include.h"
+#include "../../toolkits/toolkits.h"
+#include "../../EnumDefinitions/EnumDefinitions.h"
+
+KML_Object* KMLFileReadx(FILE* fid){
+
+	int     c;
+	char*   kstr;
+	int     ival;
+	bool    bval;
+	char*   pstr=NULL;
+	double  (*pdval3)[3]=NULL;
+	KML_Object*    kobj=NULL;
+	KML_Document*  kdoc=NULL;
+
+	clock_t clock0,clock1;
+	time_t  time0, time1;
+
+	clock0=clock();
+	time0 =time(NULL);
+	_printf_(true,"\nKMLFileReadx Module -- %s",ctime(&time0));
+
+/*  read kml file  */
+
+//	while ((c=getc(fid)) != EOF)
+//		_printf_(true,"%c",c);
+	while (kstr=KMLFileToken(fid)) {
+		if (!strncmp(kstr,"<?xml"      ,5) ||
+			!strncmp(kstr,"<kml"       ,4) ||
+			!strncmp(kstr,"<LineString",11) ||
+			!strncmp(kstr,"<LinearRing",11))
+			KMLFileTagAttrib(NULL,
+							 kstr);
+		if (!strcmp(kstr,"<extrude>"))
+			KMLFileTokenParse(&ival,
+							  kstr,
+							  fid);
+		if (!strcmp(kstr,"<tessellate>"))
+			KMLFileTokenParse(&bval,
+							  kstr,
+							  fid);
+		if (!strcmp(kstr,"<altitudeMode>"))
+			pstr=KMLFileTokenParse((char *)NULL,NULL,0,
+							  kstr,
+							  fid);
+		if (!strcmp(kstr,"<coordinates>"))
+			KMLFileTokenParse(&pdval3,NULL,0,
+							  kstr,
+							  fid);
+		if (!strncmp(kstr,"<LinearRing",11))
+			KMLFileTagSkip(kstr,
+						   fid);
+		if (!strncmp(kstr,"<Document",9)) {
+			kdoc=new KML_Document();
+			kdoc->Read(fid,kstr);
+//			kdoc->DeepEcho();
+			kobj=kdoc;
+		}
+
+//		_printf_(true,"%s\n",kstr);
+		xfree((void**)&kstr);
+	}
+
+	clock1=clock();
+	time1 =time(NULL);
+	_printf_(true,"KMLFileReadx Module -- %f CPU seconds; %f elapsed seconds.\n\n",
+			 ((double)(clock1-clock0))/CLOCKS_PER_SEC,difftime(time1,time0));
+
+	return(kobj);
+}
+
Index: /issm/trunk/src/c/modules/KMLMeshWritex/KMLFileReadx.h
===================================================================
--- /issm/trunk/src/c/modules/KMLMeshWritex/KMLFileReadx.h	(revision 8461)
+++ /issm/trunk/src/c/modules/KMLMeshWritex/KMLFileReadx.h	(revision 8461)
@@ -0,0 +1,15 @@
+/*!\file:  KMLFileReadx.h
+ * \brief header file for kml mesh writer routines.
+ */ 
+
+#ifndef _KMLFILEREADX_H
+#define _KMLFILEREADX_H
+
+#include <float.h>    /*  DBL_MAX  */
+#include "../../Container/Container.h"
+#include "../../objects/objects.h"
+
+/* local prototypes: */
+KML_Object* KMLFileReadx(FILE* fid);
+
+#endif  /* _KMLFILEREADX_H */
Index: /issm/trunk/src/c/modules/KMLMeshWritex/KMLMeshWritex.cpp
===================================================================
--- /issm/trunk/src/c/modules/KMLMeshWritex/KMLMeshWritex.cpp	(revision 8460)
+++ /issm/trunk/src/c/modules/KMLMeshWritex/KMLMeshWritex.cpp	(revision 8461)
@@ -24,4 +24,5 @@
 	double  popac=0.50;
 	char    indent[81]="  ";
+	char    cstr[81];
 	double* edata=NULL;
 	bool    ncfree=false,
@@ -59,5 +60,5 @@
 	sprintf(kpsty->colormode ,"random");
 	kstyle=new KML_Style();
-	sprintf(kstyle->id        ,"BlackLineRandomPoly");
+	kstyle->AddAttrib("id","BlackLineRandomPoly");
 	kstyle->line      =klsty;
 	kstyle->poly      =kpsty;
@@ -72,5 +73,5 @@
 	sprintf(kpsty->colormode ,"random");
 	kstyle=new KML_Style();
-	sprintf(kstyle->id        ,"BlackLineEmptyPoly");
+	kstyle->AddAttrib("id","BlackLineEmptyPoly");
 	kstyle->line      =klsty;
 	kstyle->poly      =kpsty;
@@ -85,5 +86,5 @@
 	sprintf(kpsty->colormode ,"random");
 	kstyle=new KML_Style();
-	sprintf(kstyle->id        ,"RedLineRedPoly");
+	kstyle->AddAttrib("id","RedLineRedPoly");
 	kstyle->line      =klsty;
 	kstyle->poly      =kpsty;
@@ -106,5 +107,6 @@
 			sprintf(kpsty->colormode ,"normal");
 			kstyle=new KML_Style();
-			sprintf(kstyle->id        ,"MatlabColor%d",i+1);
+			sprintf(cstr,"MatlabColor%d",i+1);
+			kstyle->AddAttrib("id",cstr);
 			kstyle->line      =klsty;
 			kstyle->poly      =kpsty;
Index: /issm/trunk/src/c/modules/KMLMeshWritex/KMLMeshWritex.h
===================================================================
--- /issm/trunk/src/c/modules/KMLMeshWritex/KMLMeshWritex.h	(revision 8460)
+++ /issm/trunk/src/c/modules/KMLMeshWritex/KMLMeshWritex.h	(revision 8461)
@@ -3,6 +3,6 @@
  */ 
 
-#ifndef _KMLMeshWriteX_H
-#define _KMLMeshWriteX_H
+#ifndef _KMLMESHWRITEX_H
+#define _KMLMESHWRITEX_H
 
 #include <float.h>    /*  DBL_MAX  */
@@ -28,3 +28,3 @@
 						double* cmap, int mcmap, int ncmap);
 
-#endif  /* _KMLMeshWriteX_H */
+#endif  /* _KMLMESHWRITEX_H */
Index: /issm/trunk/src/c/modules/modules.h
===================================================================
--- /issm/trunk/src/c/modules/modules.h	(revision 8460)
+++ /issm/trunk/src/c/modules/modules.h	(revision 8461)
@@ -49,4 +49,5 @@
 #include "./InputUpdateFromVectorDakotax/InputUpdateFromVectorDakotax.h"
 #include "./InputArtificialNoisex/InputArtificialNoisex.h"
+#include "./KMLMeshWritex/KMLFileReadx.h"
 #include "./KMLMeshWritex/KMLMeshWritex.h"
 #include "./MassFluxx/MassFluxx.h"
Index: /issm/trunk/src/c/objects/KML/KMLFileReadUtils.cpp
===================================================================
--- /issm/trunk/src/c/objects/KML/KMLFileReadUtils.cpp	(revision 8460)
+++ /issm/trunk/src/c/objects/KML/KMLFileReadUtils.cpp	(revision 8461)
@@ -94,9 +94,9 @@
 		}
 
-	if      (itag)
-		_printf_(true,"tag buffer (length=%d):\n",ibuf);
-	else if (ifield)
-		_printf_(true,"field buffer (length=%d):\n",ibuf);
-	_printf_(true,"%s\n",buffer);
+//	if      (itag)
+//		_printf_(true,"tag buffer (length=%d):\n",ibuf);
+//	else if (ifield)
+//		_printf_(true,"field buffer (length=%d):\n",ibuf);
+//	_printf_(true,"%s\n",buffer);
 
 	if (!ibuf)
@@ -131,17 +131,13 @@
 
 /*FUNCTION  KMLFileTagAttrib {{{1*/
-char* KMLFileTagAttrib(char* pstr,int *m,int maxlen,
-					   char* ktag,
-					   char* att){
+void KMLFileTagAttrib(KML_Object* kobj,
+					  char* ktag){
 
 	char*   ktagi;
-	char*   ktok;
+	char*   ktokn;
+	char*   ktokv;
 	char    quote[]={'\"','\0'};
-	char*   pstro=NULL;
-
-	if (pstr)
-		(pstr)[0]='\0';
-
-/*  ktok modifies ktag, so work on copy  */
+
+/*  strtok modifies ktag, so work on copy  */
 
 	ktagi=(char *) xmalloc((strlen(ktag)+1)*sizeof(char));
@@ -150,44 +146,19 @@
 /*  loop through tag to find all attributes  */
 
-	ktok=strtok(ktagi," ");
-	while (ktok=strtok(NULL," =?>")) {
-		_printf_(true,"KMLFileTagAttrib -- attribute %s",ktok);
-
-/*  check if it's the specified attribute  */
-
-		if (!strcmp(ktok,att)) {
-			ktok=strtok(NULL,quote);
-			_printf_(true,"=\"%s\" found.\n",ktok);
-
-			if (!pstr) {
-				pstr=(char *) xmalloc((strlen(ktok)+1)*sizeof(char));
-				pstro=pstr;
-			}
-
-			if (maxlen && (maxlen < strlen(ktok))) {
-				_printf_(true,"KMLFileTagAttrib -- string field too short for attribute \"%s\".\n",att);
-				_printf_(true,"KMLFileTagAttrib -- \"%s\" truncated to %d characters.\n",ktok,maxlen);
-				strncpy(pstr,ktok,maxlen);
-			}
-			else
-				strcpy(pstr,ktok);
-		}
-		else {
-			ktok=strtok(NULL,quote);
-			_printf_(true,"=\"%s\" skipped.\n",ktok);
-		}
+	ktokn=strtok(ktagi," ");
+	while (ktokn=strtok(NULL," =?>")) {
+
+		ktokv=strtok(NULL,quote);
+		_printf_(true,"KMLFileTagAttrib -- attribute %s=\"%s\".\n",ktokn,ktokv);
+
+/*  add the attribute to the dataset  */
+
+		if (kobj)
+			kobj->AddAttrib(ktokn,ktokv);
 	}
 
 	xfree((void**)&ktagi);
 
-	if (pstr && m)
-		*m=strlen(pstr);
-
-	if (pstr)
-		_printf_(true,"KMLFileTagAttrib -- attribute %s=\"%s\".\n",att,pstr);
-	else
-		_printf_(true,"KMLFileTagAttrib -- attribute \"%s\" not found.\n",att);
-
-	return(pstro);
+	return;
 }
 /*}}}*/
@@ -220,5 +191,5 @@
 			xfree((void**)&kstr);
 
-	_printf_(true,"KMLFileTokenParse -- %s=%d.\n",ktag,*pival);
+//	_printf_(true,"KMLFileTokenParse -- %s=%d.\n",ktag,*pival);
 
 	return(0);
@@ -255,5 +226,5 @@
 			xfree((void**)&kstr);
 
-	_printf_(true,"KMLFileTokenParse -- %s=%s.\n",ktag,(*pbval ? "true" : "false"));
+//	_printf_(true,"KMLFileTokenParse -- %s=%s.\n",ktag,(*pbval ? "true" : "false"));
 
 	return(0);
@@ -306,7 +277,40 @@
 			xfree((void**)&kstr);
 
-	_printf_(true,"KMLFileTokenParse -- %s=\"%s\".\n",ktag,pstr);
+//	_printf_(true,"KMLFileTokenParse -- %s=\"%s\".\n",ktag,pstr);
 
 	return(pstro);
+}
+/*}}}*/
+
+/*FUNCTION  KMLFileTokenParse {{{1*/
+int KMLFileTokenParse(float* pfval,
+					  char* ktag,
+					  FILE* fid){
+
+	char*   kstr;
+
+/*  get next token and convert to appropriate format  */
+
+	if (!(kstr=KMLFileToken(fid)) ||
+		(kstr[0] == '<'))
+		_error_("KMLFileTokenParse -- Missing integer field for %s.\n",ktag);
+
+	sscanf(kstr,"%g",pfval);
+	xfree((void**)&kstr);
+
+/*  get additional token and compare to closing tag  */
+
+	if (ktag)
+		if (!(kstr=KMLFileToken(fid)) ||
+			(kstr[0] != '<') ||
+			(kstr[1] != '/') ||
+			(strncmp(&(kstr[2]),&(ktag[1]),strlen(ktag)-1)))
+			_error_("KMLFileTokenParse -- Missing closing tag for %s.\n",ktag);
+		else
+			xfree((void**)&kstr);
+
+//	_printf_(true,"KMLFileTokenParse -- %s=%g.\n",ktag,*pfval);
+
+	return(0);
 }
 /*}}}*/
@@ -370,7 +374,7 @@
 			xfree((void**)&kstr);
 
-	_printf_(true,"KMLFileTokenParse -- %s=...\n",ktag);
-	for (j=0; j<=i; j++)
-		_printf_(true,"   [%d][0-2]: %g,%g,%g\n",j,(*pdval3)[j][0],(*pdval3)[j][1],(*pdval3)[j][2]);
+//	_printf_(true,"KMLFileTokenParse -- %s=...\n",ktag);
+//	for (j=0; j<=i; j++)
+//		_printf_(true,"   [%d][0-2]: %g,%g,%g\n",j,(*pdval3)[j][0],(*pdval3)[j][1],(*pdval3)[j][2]);
 
 	return(0);
Index: /issm/trunk/src/c/objects/KML/KMLFileReadUtils.h
===================================================================
--- /issm/trunk/src/c/objects/KML/KMLFileReadUtils.h	(revision 8460)
+++ /issm/trunk/src/c/objects/KML/KMLFileReadUtils.h	(revision 8461)
@@ -19,7 +19,6 @@
 						int c,
 						int bufblk);
-char* KMLFileTagAttrib(char* pstr,int *m,int maxlen,
-					   char* ktag,
-					   char* att);
+void KMLFileTagAttrib(KML_Object* kobj,
+					  char* ktag);
 int KMLFileTokenParse(int* pint,
 					  char* ktag,
@@ -29,4 +28,7 @@
 					  FILE* fid);
 char* KMLFileTokenParse(char* pstr,int *m,int maxlen,
+					  char* ktag,
+					  FILE* fid);
+int KMLFileTokenParse(float* pfl,
 					  char* ktag,
 					  FILE* fid);
Index: /issm/trunk/src/c/objects/KML/KML_Attribute.cpp
===================================================================
--- /issm/trunk/src/c/objects/KML/KML_Attribute.cpp	(revision 8461)
+++ /issm/trunk/src/c/objects/KML/KML_Attribute.cpp	(revision 8461)
@@ -0,0 +1,140 @@
+/*!\file KML_Attribute.cpp
+ * \brief: implementation of the kml_attribute 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 "../../Container/Container.h"
+#include "../../include/include.h"
+/*}}}*/
+
+/*Constructors/destructor/copy*/
+/*FUNCTION KML_Attribute::KML_Attribute(){{{1*/
+KML_Attribute::KML_Attribute(){
+
+	name      =NULL;
+	value     =NULL;
+
+}
+/*}}}*/
+/*FUNCTION KML_Attribute::~KML_Attribute(){{{1*/
+KML_Attribute::~KML_Attribute(){
+
+	if (name      ) xfree((void**)&name);
+	if (value     ) xfree((void**)&value);
+
+}
+/*}}}*/
+
+/*Other*/
+/*FUNCTION KML_Attribute::Echo {{{1*/
+void  KML_Attribute::Echo(){
+
+	int   i;
+	bool  flag=true;
+
+	_printf_(flag,"    ");
+	for (i=0;i<10-strlen(name);i++)
+		_printf_(flag," ");
+	_printf_(flag,"%s: \"%s\"\n",name,value);
+
+	return;
+}
+/*}}}*/
+
+/*FUNCTION KML_Attribute::DeepEcho {{{1*/
+void  KML_Attribute::DeepEcho(){
+
+	char  indent[81]="";
+
+	KML_Attribute::DeepEcho(indent);
+
+	return;
+}
+/*}}}*/
+
+/*FUNCTION KML_Attribute::DeepEcho {{{1*/
+void  KML_Attribute::DeepEcho(char* indent){
+
+	int   i;
+	bool  flag=true;
+
+	_printf_(flag,"%s    ",indent);
+	for (i=0;i<10-strlen(name);i++)
+		_printf_(flag," ");
+	_printf_(flag,"%s: \"%s\"\n",name,value);
+
+	return;
+}
+/*}}}*/
+
+/*FUNCTION KML_Attribute::Write {{{1*/
+void  KML_Attribute::Write(FILE* filout,char* indent){
+
+//  attributes always written in keyword line of kml_object
+
+	fprintf(filout,"%s%s=\"%s\"",indent,name,value);
+
+	return;
+}
+/*}}}*/
+
+/*FUNCTION KML_Attribute::Read {{{1*/
+void  KML_Attribute::Read(FILE* fid,char* kstr){
+
+//  attributes always read in keyword line of kml_object
+
+	;
+
+	return;
+}
+/*}}}*/
+
+/*FUNCTION KML_Attribute::Alloc {{{1*/
+void  KML_Attribute::Alloc(char* namei,char* valuei){
+
+	name =(char *) xmalloc((strlen(namei )+1)*sizeof(char));
+	strcpy(name      ,namei);
+
+	value=(char *) xmalloc((strlen(valuei)+1)*sizeof(char));
+	strcpy(value     ,valuei);
+
+	return;
+}
+/*}}}*/
+
+/*FUNCTION KML_Attribute::Add {{{1*/
+void  KML_Attribute::Add(DataSet* attrib){
+
+	attrib->AddObject((Object*)this);
+
+	return;
+}
+/*}}}*/
+
+/*FUNCTION KML_Attribute::Get {{{1*/
+void  KML_Attribute::Get(char** pvalueo,char* deflt){
+
+	if (!value || !strlen(value)) {
+		*pvalueo=(char *) xmalloc((strlen(deflt)+1)*sizeof(char));
+		strcpy(*pvalueo,deflt);
+	}
+	else {
+		*pvalueo=(char *) xmalloc((strlen(value)+1)*sizeof(char));
+		strcpy(*pvalueo,value);
+	}
+
+	return;
+}
+/*}}}*/
+
Index: /issm/trunk/src/c/objects/KML/KML_Attribute.h
===================================================================
--- /issm/trunk/src/c/objects/KML/KML_Attribute.h	(revision 8461)
+++ /issm/trunk/src/c/objects/KML/KML_Attribute.h	(revision 8461)
@@ -0,0 +1,50 @@
+/*! \file KML_Attribute.h 
+ *  \brief: header file for kml_attribute object
+ */
+
+#ifndef _KML_ATTRIBUTE_H_
+#define _KML_ATTRIBUTE_H_
+
+/*Headers:{{{1*/
+#include "../../include/include.h"
+#include "../../shared/Exceptions/exceptions.h"
+#include "../../EnumDefinitions/EnumDefinitions.h"
+
+#include "../Object.h"
+class DataSet;
+/*}}}*/
+
+class KML_Attribute: public Object {
+
+	public:
+
+		char* name;
+		char* value;
+
+		/*KML_Attribute constructors, destructors {{{1*/
+		KML_Attribute();
+		~KML_Attribute();
+		/*}}}*/
+		/*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   Enum(){_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* namei,char* valuei);
+		void  Add(DataSet* attrib);
+		void  Get(char** pvalueo,char* deflt);
+
+};
+#endif  /* _KML_ATTRIBUTE_H */
+
Index: /issm/trunk/src/c/objects/KML/KML_ColorStyle.cpp
===================================================================
--- /issm/trunk/src/c/objects/KML/KML_ColorStyle.cpp	(revision 8460)
+++ /issm/trunk/src/c/objects/KML/KML_ColorStyle.cpp	(revision 8461)
@@ -95,5 +95,5 @@
 /*  process field within opening and closing tags  */
 
-	if      (!strncmp(kstr,"</ColorStyle",11))
+	if      (!strncmp(kstr,"</ColorStyle",12))
 		return;
 	else if (!strncmp(kstr,"</",2))
Index: /issm/trunk/src/c/objects/KML/KML_Container.cpp
===================================================================
--- /issm/trunk/src/c/objects/KML/KML_Container.cpp	(revision 8460)
+++ /issm/trunk/src/c/objects/KML/KML_Container.cpp	(revision 8461)
@@ -79,7 +79,7 @@
 	if (feature->Size())
 		for (i=0; i<feature->Size(); i++) {
-			_printf_(flag,"%s       feature: [%d] begin\n" ,indent,i);
+			_printf_(flag,"%s       feature: -------- begin [%d] --------\n" ,indent,i);
 			((KML_Feature *)feature->GetObjectByOffset(i))->DeepEcho(indent2);
-			_printf_(flag,"%s       feature: [%d] end\n"   ,indent,i);
+			_printf_(flag,"%s       feature: --------  end  [%d] --------\n" ,indent,i);
 		}
 	else
Index: /issm/trunk/src/c/objects/KML/KML_Container.h
===================================================================
--- /issm/trunk/src/c/objects/KML/KML_Container.h	(revision 8460)
+++ /issm/trunk/src/c/objects/KML/KML_Container.h	(revision 8461)
@@ -13,4 +13,5 @@
 
 #include "./KML_Feature.h"
+class DataSet;
 /*}}}*/
 
Index: /issm/trunk/src/c/objects/KML/KML_Document.cpp
===================================================================
--- /issm/trunk/src/c/objects/KML/KML_Document.cpp	(revision 8460)
+++ /issm/trunk/src/c/objects/KML/KML_Document.cpp	(revision 8461)
@@ -74,8 +74,7 @@
 void  KML_Document::Write(FILE* filout,char* indent){
 
-	if (this->id && strlen(this->id))
-		fprintf(filout,"%s<Document id=\"%s\">\n",indent,this->id);
-	else
-		fprintf(filout,"%s<Document>\n",indent);
+	fprintf(filout,"%s<Document",indent);
+	WriteAttrib(filout," ");
+	fprintf(filout,">\n");
 
 	KML_Container::Write(filout,indent);
@@ -92,10 +91,8 @@
 	char*        kstri;
 
-/*  check for id attribute  */
+/*  get object attributes  */
 
-//	KML_Object::Read(fid,kstr);
-	KMLFileTagAttrib( id        ,NULL,KML_OBJECT_ID_LENGTH,
-					 kstr,
-					 "id");
+	KMLFileTagAttrib(this,
+					 kstr);
 
 /*  loop over and process fields within opening and closing tags  */
Index: /issm/trunk/src/c/objects/KML/KML_Document.h
===================================================================
--- /issm/trunk/src/c/objects/KML/KML_Document.h	(revision 8460)
+++ /issm/trunk/src/c/objects/KML/KML_Document.h	(revision 8461)
@@ -14,5 +14,4 @@
 #include "./KML_Container.h"
 class KML_Feature;
-class DataSet;
 /*}}}*/
 
Index: /issm/trunk/src/c/objects/KML/KML_Feature.cpp
===================================================================
--- /issm/trunk/src/c/objects/KML/KML_Feature.cpp	(revision 8460)
+++ /issm/trunk/src/c/objects/KML/KML_Feature.cpp	(revision 8461)
@@ -98,7 +98,7 @@
 	if (style->Size())
 		for (i=0; i<style->Size(); i++) {
-			_printf_(flag,"%s         style: [%d] begin\n" ,indent,i);
+			_printf_(flag,"%s         style: -------- begin [%d] --------\n" ,indent,i);
 			((KML_Style *)style->GetObjectByOffset(i))->DeepEcho(indent2);
-			_printf_(flag,"%s         style: [%d] end\n"   ,indent,i);
+			_printf_(flag,"%s         style: --------  end  [%d] --------\n" ,indent,i);
 		}
 	else
Index: /issm/trunk/src/c/objects/KML/KML_Folder.cpp
===================================================================
--- /issm/trunk/src/c/objects/KML/KML_Folder.cpp	(revision 8460)
+++ /issm/trunk/src/c/objects/KML/KML_Folder.cpp	(revision 8461)
@@ -74,10 +74,7 @@
 void  KML_Folder::Write(FILE* filout,char* indent){
 
-	int   i;
-
-	if (this->id && strlen(this->id))
-		fprintf(filout,"%s<Folder id=\"%s\">\n",indent,this->id);
-	else
-		fprintf(filout,"%s<Folder>\n",indent);
+	fprintf(filout,"%s<Folder",indent);
+	WriteAttrib(filout," ");
+	fprintf(filout,">\n");
 
 	KML_Container::Write(filout,indent);
@@ -94,10 +91,8 @@
 	char*        kstri;
 
-/*  check for id attribute  */
+/*  get object attributes  */
 
-//	KML_Object::Read(fid,kstr);
-	KMLFileTagAttrib( id        ,NULL,KML_OBJECT_ID_LENGTH,
-					 kstr,
-					 "id");
+	KMLFileTagAttrib(this,
+					 kstr);
 
 /*  loop over and process fields within opening and closing tags  */
Index: /issm/trunk/src/c/objects/KML/KML_Folder.h
===================================================================
--- /issm/trunk/src/c/objects/KML/KML_Folder.h	(revision 8460)
+++ /issm/trunk/src/c/objects/KML/KML_Folder.h	(revision 8461)
@@ -14,5 +14,4 @@
 #include "./KML_Container.h"
 class KML_Feature;
-class DataSet;
 /*}}}*/
 
Index: /issm/trunk/src/c/objects/KML/KML_Geometry.cpp
===================================================================
--- /issm/trunk/src/c/objects/KML/KML_Geometry.cpp	(revision 8460)
+++ /issm/trunk/src/c/objects/KML/KML_Geometry.cpp	(revision 8461)
@@ -77,5 +77,15 @@
 void  KML_Geometry::Read(FILE* fid,char* kstr){
 
-	KML_Object::Read(fid,kstr);
+/*  process field within opening and closing tags  */
+
+	if      (!strncmp(kstr,"</Geometry",10))
+		return;
+	else if (!strncmp(kstr,"</",2))
+		_error_("KML_Geometry::Read -- Unexpected closing tag %s.\n",kstr);
+	else if (strncmp(kstr,"<",1))
+		_error_("KML_Geometry::Read -- Unexpected field \"%s\".\n",kstr);
+
+	else if (!strncmp(kstr,"<",1))
+		KML_Object::Read(fid,kstr);
 
 	return;
Index: /issm/trunk/src/c/objects/KML/KML_LineString.cpp
===================================================================
--- /issm/trunk/src/c/objects/KML/KML_LineString.cpp	(revision 8460)
+++ /issm/trunk/src/c/objects/KML/KML_LineString.cpp	(revision 8461)
@@ -97,8 +97,7 @@
 	int   i;
 
-	if (this->id && strlen(this->id))
-		fprintf(filout,"%s<LineString id=\"%s\">\n",indent,this->id);
-	else
-		fprintf(filout,"%s<LineString>\n",indent);
+	fprintf(filout,"%s<LineString",indent);
+	WriteAttrib(filout," ");
+	fprintf(filout,">\n");
 
 	KML_Geometry::Write(filout,indent);
@@ -125,4 +124,45 @@
 void  KML_LineString::Read(FILE* fid,char* kstr){
 
+	char*        kstri;
+
+/*  get object attributes  */
+
+	KMLFileTagAttrib(this,
+					 kstr);
+
+/*  loop over and process fields within opening and closing tags  */
+
+	while (kstri=KMLFileToken(fid)) {
+		if      (!strncmp(kstri,"</LineString",12)) {
+			xfree((void**)&kstri);
+			break;
+		}
+		else if (!strncmp(kstri,"</",2))
+			_error_("KML_LineString::Read -- Unexpected closing tag %s.\n",kstri);
+		else if (strncmp(kstri,"<",1))
+			_error_("KML_LineString::Read -- Unexpected field \"%s\".\n",kstri);
+
+		else if (!strcmp(kstri,"<extrude>"))
+			KMLFileTokenParse(&extrude   ,
+							  kstri,
+							  fid);
+		else if (!strcmp(kstri,"<tessellate>"))
+			KMLFileTokenParse(&tessellate,
+							  kstri,
+							  fid);
+		else if (!strcmp(kstri,"<altitudeMode>"))
+			KMLFileTokenParse( altmode   ,NULL,KML_LINESTRING_ALTMODE_LENGTH,
+							  kstri,
+							  fid);
+		else if (!strcmp(kstri,"<coordinates>"))
+			KMLFileTokenParse(&coords    ,&ncoord    ,0,
+							  kstri,
+							  fid);
+
+		else if (!strncmp(kstri,"<",1))
+			KML_Geometry::Read(fid,kstri);
+
+		xfree((void**)&kstri);
+	}
 
 	return;
Index: /issm/trunk/src/c/objects/KML/KML_LineStyle.cpp
===================================================================
--- /issm/trunk/src/c/objects/KML/KML_LineStyle.cpp	(revision 8460)
+++ /issm/trunk/src/c/objects/KML/KML_LineStyle.cpp	(revision 8461)
@@ -23,5 +23,5 @@
 KML_LineStyle::KML_LineStyle(){
 
-	width     =1;
+	width     =1.;
 
 }
@@ -44,5 +44,5 @@
 	KML_ColorStyle::Echo();
 
-	_printf_(flag,"         width: %d\n"          ,width);
+	_printf_(flag,"         width: %g\n"          ,width);
 
 	return;
@@ -70,5 +70,5 @@
 	KML_ColorStyle::DeepEcho(indent);
 
-	_printf_(flag,"%s         width: %d\n"          ,indent,width);
+	_printf_(flag,"%s         width: %g\n"          ,indent,width);
 
 	return;
@@ -79,14 +79,11 @@
 void  KML_LineStyle::Write(FILE* filout,char* indent){
 
-	int   i;
-
-	if (this->id && strlen(this->id))
-		fprintf(filout,"%s<LineStyle id=\"%s\">\n",indent,this->id);
-	else
-		fprintf(filout,"%s<LineStyle>\n",indent);
+	fprintf(filout,"%s<LineStyle",indent);
+	WriteAttrib(filout," ");
+	fprintf(filout,">\n");
 
 	KML_ColorStyle::Write(filout,indent);
 
-	fprintf(filout,"%s  <width>%d</width>\n",indent,width);
+	fprintf(filout,"%s  <width>%g</width>\n",indent,width);
 
 	fprintf(filout,"%s</LineStyle>\n",indent);
@@ -99,4 +96,33 @@
 void  KML_LineStyle::Read(FILE* fid,char* kstr){
 
+	char*        kstri;
+
+/*  get object attributes  */
+
+	KMLFileTagAttrib(this,
+					 kstr);
+
+/*  loop over and process fields within opening and closing tags  */
+
+	while (kstri=KMLFileToken(fid)) {
+		if      (!strncmp(kstri,"</LineStyle",11)) {
+			xfree((void**)&kstri);
+			break;
+		}
+		else if (!strncmp(kstri,"</",2))
+			_error_("KML_LineStyle::Read -- Unexpected closing tag %s.\n",kstri);
+		else if (strncmp(kstri,"<",1))
+			_error_("KML_LineStyle::Read -- Unexpected field \"%s\".\n",kstri);
+
+		else if (!strcmp(kstri,"<width>"))
+			KMLFileTokenParse(&width     ,
+							  kstri,
+							  fid);
+
+		else if (!strncmp(kstri,"<",1))
+			KML_ColorStyle::Read(fid,kstri);
+
+		xfree((void**)&kstri);
+	}
 
 	return;
Index: /issm/trunk/src/c/objects/KML/KML_LineStyle.h
===================================================================
--- /issm/trunk/src/c/objects/KML/KML_LineStyle.h	(revision 8460)
+++ /issm/trunk/src/c/objects/KML/KML_LineStyle.h	(revision 8461)
@@ -19,5 +19,5 @@
 	public:
 
-		int   width;
+		float width;
 
 		/*KML_LineStyle constructors, destructors {{{1*/
Index: /issm/trunk/src/c/objects/KML/KML_LinearRing.cpp
===================================================================
--- /issm/trunk/src/c/objects/KML/KML_LinearRing.cpp	(revision 8460)
+++ /issm/trunk/src/c/objects/KML/KML_LinearRing.cpp	(revision 8461)
@@ -97,8 +97,7 @@
 	int   i;
 
-	if (this->id && strlen(this->id))
-		fprintf(filout,"%s<LinearRing id=\"%s\">\n",indent,this->id);
-	else
-		fprintf(filout,"%s<LinearRing>\n",indent);
+	fprintf(filout,"%s<LinearRing",indent);
+	WriteAttrib(filout," ");
+	fprintf(filout,">\n");
 
 	KML_Geometry::Write(filout,indent);
@@ -125,4 +124,45 @@
 void  KML_LinearRing::Read(FILE* fid,char* kstr){
 
+	char*        kstri;
+
+/*  get object attributes  */
+
+	KMLFileTagAttrib(this,
+					 kstr);
+
+/*  loop over and process fields within opening and closing tags  */
+
+	while (kstri=KMLFileToken(fid)) {
+		if      (!strncmp(kstri,"</LinearRing",12)) {
+			xfree((void**)&kstri);
+			break;
+		}
+		else if (!strncmp(kstri,"</",2))
+			_error_("KML_LinearRing::Read -- Unexpected closing tag %s.\n",kstri);
+		else if (strncmp(kstri,"<",1))
+			_error_("KML_LinearRing::Read -- Unexpected field \"%s\".\n",kstri);
+
+		else if (!strcmp(kstri,"<extrude>"))
+			KMLFileTokenParse(&extrude   ,
+							  kstri,
+							  fid);
+		else if (!strcmp(kstri,"<tessellate>"))
+			KMLFileTokenParse(&tessellate,
+							  kstri,
+							  fid);
+		else if (!strcmp(kstri,"<altitudeMode>"))
+			KMLFileTokenParse( altmode   ,NULL,KML_LINEARRING_ALTMODE_LENGTH,
+							  kstri,
+							  fid);
+		else if (!strcmp(kstri,"<coordinates>"))
+			KMLFileTokenParse(&coords    ,&ncoord    ,0,
+							  kstri,
+							  fid);
+
+		else if (!strncmp(kstri,"<",1))
+			KML_Geometry::Read(fid,kstri);
+
+		xfree((void**)&kstri);
+	}
 
 	return;
Index: /issm/trunk/src/c/objects/KML/KML_MultiGeometry.cpp
===================================================================
--- /issm/trunk/src/c/objects/KML/KML_MultiGeometry.cpp	(revision 8460)
+++ /issm/trunk/src/c/objects/KML/KML_MultiGeometry.cpp	(revision 8461)
@@ -81,7 +81,7 @@
 	if (geometry->Size())
 		for (i=0; i<geometry->Size(); i++) {
-			_printf_(flag,"%s      geometry: [%d] begin\n" ,indent,i);
+			_printf_(flag,"%s      geometry: -------- begin [%d] --------\n" ,indent,i);
 			((KML_Geometry *)geometry->GetObjectByOffset(i))->DeepEcho(indent2);
-			_printf_(flag,"%s      geometry: [%d] end\n"   ,indent,i);
+			_printf_(flag,"%s      geometry: --------  end  [%d] --------\n" ,indent,i);
 		}
 	else
@@ -98,8 +98,7 @@
 	char  indent2[81];
 
-	if (this->id && strlen(this->id))
-		fprintf(filout,"%s<MultiGeometry id=\"%s\">\n",indent,this->id);
-	else
-		fprintf(filout,"%s<MultiGeometry>\n",indent);
+	fprintf(filout,"%s<MultiGeometry",indent);
+	WriteAttrib(filout," ");
+	fprintf(filout,">\n");
 
 	KML_Geometry::Write(filout,indent);
@@ -122,4 +121,59 @@
 void  KML_MultiGeometry::Read(FILE* fid,char* kstr){
 
+	char*        kstri;
+	KML_Object*  kobj;
+
+/*  get object attributes  */
+
+	KMLFileTagAttrib(this,
+					 kstr);
+
+/*  loop over and process fields within opening and closing tags  */
+
+	while (kstri=KMLFileToken(fid)) {
+		if      (!strncmp(kstri,"</MultiGeometry",15)) {
+			xfree((void**)&kstri);
+			break;
+		}
+		else if (!strncmp(kstri,"</",2))
+			_error_("KML_MultiGeometry::Read -- Unexpected closing tag %s.\n",kstri);
+		else if (strncmp(kstri,"<",1))
+			_error_("KML_MultiGeometry::Read -- Unexpected field \"%s\".\n",kstri);
+
+//		else if (!strncmp(kstri,"<Point", 6)) {
+//			kobj=(KML_Object*)new KML_Point();
+//			kobj->Read(fid,kstri);
+//			geometry  ->AddObject((Object*)kobj);
+//		}
+
+		else if (!strncmp(kstri,"<LineString",11)) {
+			kobj=(KML_Object*)new KML_LineString();
+			kobj->Read(fid,kstri);
+			geometry  ->AddObject((Object*)kobj);
+		}
+
+		else if (!strncmp(kstri,"<LinearRing",11)) {
+			kobj=(KML_Object*)new KML_LinearRing();
+			kobj->Read(fid,kstri);
+			geometry  ->AddObject((Object*)kobj);
+		}
+
+		else if (!strncmp(kstri,"<Polygon", 8)) {
+			kobj=(KML_Object*)new KML_Polygon();
+			kobj->Read(fid,kstri);
+			geometry  ->AddObject((Object*)kobj);
+		}
+
+		else if (!strncmp(kstri,"<MultiGeometry",14)) {
+			kobj=(KML_Object*)new KML_MultiGeometry();
+			kobj->Read(fid,kstri);
+			geometry  ->AddObject((Object*)kobj);
+		}
+
+		else if (!strncmp(kstri,"<",1))
+			KML_Geometry::Read(fid,kstri);
+
+		xfree((void**)&kstri);
+	}
 
 	return;
Index: /issm/trunk/src/c/objects/KML/KML_Object.cpp
===================================================================
--- /issm/trunk/src/c/objects/KML/KML_Object.cpp	(revision 8460)
+++ /issm/trunk/src/c/objects/KML/KML_Object.cpp	(revision 8461)
@@ -23,5 +23,5 @@
 KML_Object::KML_Object(){
 
-	strcpy(id        ,"");
+	attrib    =new DataSet;
 
 }
@@ -30,5 +30,8 @@
 KML_Object::~KML_Object(){
 
-	;
+	if (attrib) {
+		delete attrib;
+		attrib    =NULL;
+	}
 
 }
@@ -41,5 +44,5 @@
 	bool  flag=true;
 
-	_printf_(flag,"            id: \"%s\"\n"      ,id);
+	_printf_(flag,"        attrib: (size=%d)\n" ,attrib->Size());
 
 	return;
@@ -61,7 +64,15 @@
 void  KML_Object::DeepEcho(char* indent){
 
+	int   i;
 	bool  flag=true;
 
-	_printf_(flag,"%s            id: \"%s\"\n"      ,indent,id);
+/*  loop over the attributes for the object  */
+
+	if (attrib->Size())
+		for (i=0; i<attrib->Size(); i++) {
+			((KML_Attribute *)attrib->GetObjectByOffset(i))->DeepEcho(indent);
+		}
+	else
+		_printf_(flag,"%s        attrib: [empty]\n"    ,indent);
 
 	return;
@@ -72,5 +83,5 @@
 void  KML_Object::Write(FILE* filout,char* indent){
 
-//  id is always written in keyword line of derived classes
+//  attributes always written in keyword line of derived classes
 
 	;
@@ -102,2 +113,58 @@
 /*}}}*/
 
+/*FUNCTION KML_Object::AddAttrib {{{1*/
+void  KML_Object::AddAttrib(char* name,char* value){
+
+	KML_Attribute* katt=NULL;
+
+	katt=new KML_Attribute();
+	katt->Alloc(name,value);
+	katt->Add(attrib);
+
+	return;
+}
+/*}}}*/
+
+/*FUNCTION KML_Object::FindAttrib {{{1*/
+void  KML_Object::FindAttrib(char** pvalue,char* name,char* deflt){
+
+	int   i;
+	KML_Attribute* katt=NULL;
+
+/*  loop over any attributes for the object  */
+
+	if (attrib->Size())
+		for (i=0; i<attrib->Size(); i++)
+			if (!strcmp(((KML_Attribute *)attrib->GetObjectByOffset(i))->name,name)) {
+				katt=(KML_Attribute *)attrib->GetObjectByOffset(i);
+				break;
+			}
+
+	if (katt)
+		katt->Get(pvalue,deflt);
+	else {
+		*pvalue=(char *) xmalloc((strlen(deflt)+1)*sizeof(char));
+		strcpy(*pvalue,deflt);
+	}
+
+	return;
+}
+/*}}}*/
+
+/*FUNCTION KML_Object::WriteAttrib {{{1*/
+void  KML_Object::WriteAttrib(FILE* filout,char* indent){
+
+	int   i;
+
+//  attributes always written in keyword line of kml_object
+
+/*  loop over any attributes for the object  */
+
+	if (attrib->Size())
+		for (i=0; i<attrib->Size(); i++)
+			((KML_Attribute *)attrib->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 8460)
+++ /issm/trunk/src/c/objects/KML/KML_Object.h	(revision 8461)
@@ -6,6 +6,4 @@
 #define _KML_OBJECT_H_
 
-#define KML_OBJECT_ID_LENGTH         80
-
 /*Headers:{{{1*/
 #include "../../include/include.h"
@@ -14,4 +12,5 @@
 
 #include "../Object.h"
+class DataSet;
 /*}}}*/
 
@@ -20,5 +19,5 @@
 	public:
 
-		char  id[KML_OBJECT_ID_LENGTH+1];
+		DataSet* attrib;
 
 		/*KML_Object constructors, destructors {{{1*/
@@ -42,5 +41,7 @@
 		virtual void  Write(FILE* fid,char* indent)=0;
 		virtual void  Read(FILE* fid,char* kstr)=0;
-
+		virtual void  AddAttrib(char* name,char* value);
+		virtual void  FindAttrib(char** pvalue,char* name,char* deflt);
+		virtual void  WriteAttrib(FILE* fid,char* indent);
 
 };
Index: /issm/trunk/src/c/objects/KML/KML_Placemark.cpp
===================================================================
--- /issm/trunk/src/c/objects/KML/KML_Placemark.cpp	(revision 8460)
+++ /issm/trunk/src/c/objects/KML/KML_Placemark.cpp	(revision 8461)
@@ -81,7 +81,7 @@
 	if (geometry->Size())
 		for (i=0; i<geometry->Size(); i++) {
-			_printf_(flag,"%s      geometry: [%d] begin\n" ,indent,i);
+			_printf_(flag,"%s      geometry: -------- begin [%d] --------\n" ,indent,i);
 			((KML_Geometry *)geometry->GetObjectByOffset(i))->DeepEcho(indent2);
-			_printf_(flag,"%s      geometry: [%d] end\n"   ,indent,i);
+			_printf_(flag,"%s      geometry: --------  end  [%d] --------\n" ,indent,i);
 		}
 	else
@@ -98,8 +98,7 @@
 	char  indent2[81];
 
-	if (this->id && strlen(this->id))
-		fprintf(filout,"%s<Placemark id=\"%s\">\n",indent,this->id);
-	else
-		fprintf(filout,"%s<Placemark>\n",indent);
+	fprintf(filout,"%s<Placemark",indent);
+	WriteAttrib(filout," ");
+	fprintf(filout,">\n");
 
 	KML_Feature::Write(filout,indent);
@@ -125,10 +124,8 @@
 	KML_Object*  kobj;
 
-/*  check for id attribute  */
+/*  get object attributes  */
 
-//	KML_Object::Read(fid,kstr);
-	KMLFileTagAttrib( id        ,NULL,KML_OBJECT_ID_LENGTH,
-					 kstr,
-					 "id");
+	KMLFileTagAttrib(this,
+					 kstr);
 
 /*  loop over and process fields within opening and closing tags  */
@@ -144,7 +141,13 @@
 			_error_("KML_Placemark::Read -- Unexpected field \"%s\".\n",kstri);
 
+//		else if (!strncmp(kstri,"<Point", 6)) {
+//			kobj=(KML_Object*)new KML_Point();
+//			kobj->Read(fid,kstri);
+//			geometry  ->AddObject((Object*)kobj);
+//		}
+
 		else if (!strncmp(kstri,"<LineString",11)) {
 			kobj=(KML_Object*)new KML_LineString();
-			kobj->Read(fid,kstr);
+			kobj->Read(fid,kstri);
 			geometry  ->AddObject((Object*)kobj);
 		}
@@ -152,5 +155,5 @@
 		else if (!strncmp(kstri,"<LinearRing",11)) {
 			kobj=(KML_Object*)new KML_LinearRing();
-			kobj->Read(fid,kstr);
+			kobj->Read(fid,kstri);
 			geometry  ->AddObject((Object*)kobj);
 		}
@@ -158,5 +161,5 @@
 		else if (!strncmp(kstri,"<Polygon", 8)) {
 			kobj=(KML_Object*)new KML_Polygon();
-			kobj->Read(fid,kstr);
+			kobj->Read(fid,kstri);
 			geometry  ->AddObject((Object*)kobj);
 		}
@@ -164,5 +167,5 @@
 		else if (!strncmp(kstri,"<MultiGeometry",14)) {
 			kobj=(KML_Object*)new KML_MultiGeometry();
-			kobj->Read(fid,kstr);
+			kobj->Read(fid,kstri);
 			geometry  ->AddObject((Object*)kobj);
 		}
Index: /issm/trunk/src/c/objects/KML/KML_PolyStyle.cpp
===================================================================
--- /issm/trunk/src/c/objects/KML/KML_PolyStyle.cpp	(revision 8460)
+++ /issm/trunk/src/c/objects/KML/KML_PolyStyle.cpp	(revision 8461)
@@ -82,10 +82,7 @@
 void  KML_PolyStyle::Write(FILE* filout,char* indent){
 
-	int   i;
-
-	if (this->id && strlen(this->id))
-		fprintf(filout,"%s<PolyStyle id=\"%s\">\n",indent,this->id);
-	else
-		fprintf(filout,"%s<PolyStyle>\n",indent);
+	fprintf(filout,"%s<PolyStyle",indent);
+	WriteAttrib(filout," ");
+	fprintf(filout,">\n");
 
 	KML_ColorStyle::Write(filout,indent);
@@ -103,4 +100,37 @@
 void  KML_PolyStyle::Read(FILE* fid,char* kstr){
 
+	char*        kstri;
+
+/*  get object attributes  */
+
+	KMLFileTagAttrib(this,
+					 kstr);
+
+/*  loop over and process fields within opening and closing tags  */
+
+	while (kstri=KMLFileToken(fid)) {
+		if      (!strncmp(kstri,"</PolyStyle",11)) {
+			xfree((void**)&kstri);
+			break;
+		}
+		else if (!strncmp(kstri,"</",2))
+			_error_("KML_PolyStyle::Read -- Unexpected closing tag %s.\n",kstri);
+		else if (strncmp(kstri,"<",1))
+			_error_("KML_PolyStyle::Read -- Unexpected field \"%s\".\n",kstri);
+
+		else if (!strcmp(kstri,"<fill>"))
+			KMLFileTokenParse(&fill      ,
+							  kstri,
+							  fid);
+		else if (!strcmp(kstri,"<outline>"))
+			KMLFileTokenParse(&outline   ,
+							  kstri,
+							  fid);
+
+		else if (!strncmp(kstri,"<",1))
+			KML_ColorStyle::Read(fid,kstri);
+
+		xfree((void**)&kstri);
+	}
 
 	return;
Index: /issm/trunk/src/c/objects/KML/KML_Polygon.cpp
===================================================================
--- /issm/trunk/src/c/objects/KML/KML_Polygon.cpp	(revision 8460)
+++ /issm/trunk/src/c/objects/KML/KML_Polygon.cpp	(revision 8461)
@@ -96,7 +96,7 @@
 	if (outer->Size())
 		for (i=0; i<outer->Size(); i++) {
-			_printf_(flag,"%s         outer: [%d] begin\n" ,indent,i);
+			_printf_(flag,"%s         outer: -------- begin [%d] --------\n" ,indent,i);
 			((KML_LinearRing *)outer->GetObjectByOffset(i))->DeepEcho(indent2);
-			_printf_(flag,"%s         outer: [%d] end\n"   ,indent,i);
+			_printf_(flag,"%s         outer: --------  end  [%d] --------\n" ,indent,i);
 		}
 	else
@@ -105,7 +105,7 @@
 	if (inner->Size())
 		for (i=0; i<inner->Size(); i++) {
-			_printf_(flag,"%s         inner: [%d] begin\n" ,indent,i);
+			_printf_(flag,"%s         inner: -------- begin [%d] --------\n" ,indent,i);
 			((KML_LinearRing *)inner->GetObjectByOffset(i))->DeepEcho(indent2);
-			_printf_(flag,"%s         inner: [%d] end\n"   ,indent,i);
+			_printf_(flag,"%s         inner: --------  end  [%d] --------\n" ,indent,i);
 		}
 	else
@@ -122,8 +122,7 @@
 	char  indent4[81];
 
-	if (this->id && strlen(this->id))
-		fprintf(filout,"%s<Polygon id=\"%s\">\n",indent,this->id);
-	else
-		fprintf(filout,"%s<Polygon>\n",indent);
+	fprintf(filout,"%s<Polygon",indent);
+	WriteAttrib(filout," ");
+	fprintf(filout,">\n");
 
 	KML_Geometry::Write(filout,indent);
@@ -158,7 +157,99 @@
 void  KML_Polygon::Read(FILE* fid,char* kstr){
 
-
-	return;
-}
-/*}}}*/
-
+	char*        kstri;
+	char*        kstrj;
+	KML_Object*  kobj;
+
+/*  get object attributes  */
+
+	KMLFileTagAttrib(this,
+					 kstr);
+
+/*  loop over and process fields within opening and closing tags  */
+
+	while (kstri=KMLFileToken(fid)) {
+		if      (!strncmp(kstri,"</Polygon", 9)) {
+			xfree((void**)&kstri);
+			break;
+		}
+		else if (!strncmp(kstri,"</",2))
+			_error_("KML_Polygon::Read -- Unexpected closing tag %s.\n",kstri);
+		else if (strncmp(kstri,"<",1))
+			_error_("KML_Polygon::Read -- Unexpected field \"%s\".\n",kstri);
+
+		else if (!strcmp(kstri,"<extrude>"))
+			KMLFileTokenParse(&extrude   ,
+							  kstri,
+							  fid);
+		else if (!strcmp(kstri,"<tessellate>"))
+			KMLFileTokenParse(&tessellate,
+							  kstri,
+							  fid);
+		else if (!strcmp(kstri,"<altitudeMode>"))
+			KMLFileTokenParse( altmode   ,NULL,KML_POLYGON_ALTMODE_LENGTH,
+							  kstri,
+							  fid);
+
+		else if (!strcmp(kstri,"<outerBoundaryIs>"))
+
+/*  loop over and process fields within outer boundary  */
+
+			while (kstrj=KMLFileToken(fid)) {
+				if      (!strncmp(kstrj,"</outerBoundaryIs",17)) {
+					xfree((void**)&kstrj);
+					break;
+				}
+				else if (!strncmp(kstrj,"</",2))
+					_error_("KML_Polygon::Read -- Unexpected closing tag %s.\n",kstrj);
+				else if (strncmp(kstrj,"<",1))
+					_error_("KML_Polygon::Read -- Unexpected field \"%s\".\n",kstrj);
+
+				else if (!strncmp(kstrj,"<LinearRing",11)) {
+					kobj=(KML_Object*)new KML_LinearRing();
+					kobj->Read(fid,kstrj);
+					outer     ->AddObject((Object*)kobj);
+				}
+
+				else if (!strncmp(kstrj,"<",1))
+					KML_Geometry::Read(fid,kstrj);
+
+				xfree((void**)&kstrj);
+			}
+
+		else if (!strcmp(kstri,"<innerBoundaryIs>"))
+
+/*  loop over and process fields within inner boundaries  */
+
+			while (kstrj=KMLFileToken(fid)) {
+				if      (!strncmp(kstrj,"</innerBoundaryIs",17)) {
+					xfree((void**)&kstrj);
+					break;
+				}
+				else if (!strncmp(kstrj,"</",2))
+					_error_("KML_Polygon::Read -- Unexpected closing tag %s.\n",kstrj);
+				else if (strncmp(kstrj,"<",1))
+					_error_("KML_Polygon::Read -- Unexpected field \"%s\".\n",kstrj);
+
+				else if (!strncmp(kstrj,"<LinearRing",11)) {
+					kobj=(KML_Object*)new KML_LinearRing();
+					kobj->Read(fid,kstrj);
+					inner     ->AddObject((Object*)kobj);
+				}
+
+				else if (!strncmp(kstrj,"<",1))
+					KML_Geometry::Read(fid,kstrj);
+
+				xfree((void**)&kstrj);
+			}
+
+
+		else if (!strncmp(kstri,"<",1))
+			KML_Geometry::Read(fid,kstri);
+
+		xfree((void**)&kstri);
+	}
+
+	return;
+}
+/*}}}*/
+
Index: /issm/trunk/src/c/objects/KML/KML_Style.cpp
===================================================================
--- /issm/trunk/src/c/objects/KML/KML_Style.cpp	(revision 8460)
+++ /issm/trunk/src/c/objects/KML/KML_Style.cpp	(revision 8461)
@@ -101,5 +101,4 @@
 void  KML_Style::DeepEcho(char* indent){
 
-	int   i;
 	char  indent2[81];
 	bool  flag=true;
@@ -143,11 +142,9 @@
 void  KML_Style::Write(FILE* filout,char* indent){
 
-	int   i;
 	char  indent2[81];
 
-	if (this->id && strlen(this->id))
-		fprintf(filout,"%s<Style id=\"%s\">\n",indent,this->id);
-	else
-		fprintf(filout,"%s<Style>\n",indent);
+	fprintf(filout,"%s<Style",indent);
+	WriteAttrib(filout," ");
+	fprintf(filout,">\n");
 
 	KML_StyleSelector::Write(filout,indent);
@@ -178,7 +175,61 @@
 void  KML_Style::Read(FILE* fid,char* kstr){
 
-
-	return;
-}
-/*}}}*/
-
+	char*        kstri;
+
+/*  get object attributes  */
+
+	KMLFileTagAttrib(this,
+					 kstr);
+
+/*  loop over and process fields within opening and closing tags  */
+
+	while (kstri=KMLFileToken(fid)) {
+		if      (!strncmp(kstri,"</Style", 7)) {
+			xfree((void**)&kstri);
+			break;
+		}
+		else if (!strncmp(kstri,"</",2))
+			_error_("KML_Style::Read -- Unexpected closing tag %s.\n",kstri);
+		else if (strncmp(kstri,"<",1))
+			_error_("KML_Style::Read -- Unexpected field \"%s\".\n",kstri);
+
+//		else if (!strncmp(kstri,"<IconStyle",10)) {
+//			icon      =new KML_IconStyle();
+//			icon      ->Read(fid,kstri);
+//		}
+
+//		else if (!strncmp(kstri,"<LabelStyle",11)) {
+//			label     =new KML_LabelStyle();
+//			label     ->Read(fid,kstri);
+//		}
+
+		else if (!strncmp(kstri,"<LineStyle",10)) {
+			line      =new KML_LineStyle();
+			line      ->Read(fid,kstri);
+		}
+
+		else if (!strncmp(kstri,"<PolyStyle",10)) {
+			poly      =new KML_PolyStyle();
+			poly      ->Read(fid,kstri);
+		}
+
+//		else if (!strncmp(kstri,"<BalloonStyle",13)) {
+//			balloon   =new KML_BalloonStyle();
+//			balloon   ->Read(fid,kstri);
+//		}
+
+//		else if (!strncmp(kstri,"<ListStyle",10)) {
+//			list      =new KML_ListStyle();
+//			list      ->Read(fid,kstri);
+//		}
+
+		else if (!strncmp(kstri,"<",1))
+			KML_StyleSelector::Read(fid,kstri);
+
+		xfree((void**)&kstri);
+	}
+
+	return;
+}
+/*}}}*/
+
Index: /issm/trunk/src/c/objects/KML/KML_StyleSelector.cpp
===================================================================
--- /issm/trunk/src/c/objects/KML/KML_StyleSelector.cpp	(revision 8460)
+++ /issm/trunk/src/c/objects/KML/KML_StyleSelector.cpp	(revision 8461)
@@ -77,5 +77,15 @@
 void  KML_StyleSelector::Read(FILE* fid,char* kstr){
 
-	KML_Object::Read(fid,kstr);
+/*  process field within opening and closing tags  */
+
+	if      (!strncmp(kstr,"</StyleSelector",15))
+		return;
+	else if (!strncmp(kstr,"</",2))
+		_error_("KML_StyleSelector::Read -- Unexpected closing tag %s.\n",kstr);
+	else if (strncmp(kstr,"<",1))
+		_error_("KML_StyleSelector::Read -- Unexpected field \"%s\".\n",kstr);
+
+	else if (!strncmp(kstr,"<",1))
+		KML_Object::Read(fid,kstr);
 
 	return;
Index: /issm/trunk/src/c/objects/KML/KML_SubStyle.cpp
===================================================================
--- /issm/trunk/src/c/objects/KML/KML_SubStyle.cpp	(revision 8460)
+++ /issm/trunk/src/c/objects/KML/KML_SubStyle.cpp	(revision 8461)
@@ -77,5 +77,15 @@
 void  KML_SubStyle::Read(FILE* fid,char* kstr){
 
-	KML_Object::Read(fid,kstr);
+/*  process field within opening and closing tags  */
+
+	if      (!strncmp(kstr,"</SubStyle",10))
+		return;
+	else if (!strncmp(kstr,"</",2))
+		_error_("KML_SubStyle::Read -- Unexpected closing tag %s.\n",kstr);
+	else if (strncmp(kstr,"<",1))
+		_error_("KML_SubStyle::Read -- Unexpected field \"%s\".\n",kstr);
+
+	else if (!strncmp(kstr,"<",1))
+		KML_Object::Read(fid,kstr);
 
 	return;
Index: /issm/trunk/src/c/objects/objects.h
===================================================================
--- /issm/trunk/src/c/objects/objects.h	(revision 8460)
+++ /issm/trunk/src/c/objects/objects.h	(revision 8461)
@@ -45,4 +45,5 @@
 
 /*KML parsing objects: */
+#include "./KML/KML_Attribute.h"
 #include "./KML/KML_ColorStyle.h"
 #include "./KML/KML_Container.h"
