Index: /issm/trunk/src/c/modules/KMLMeshWritex/KMLFileReadx.cpp
===================================================================
--- /issm/trunk/src/c/modules/KMLMeshWritex/KMLFileReadx.cpp	(revision 10632)
+++ /issm/trunk/src/c/modules/KMLMeshWritex/KMLFileReadx.cpp	(revision 10633)
@@ -11,12 +11,7 @@
 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;
+	KML_File*      kxml=NULL;
+	KML_File*      kdtd=NULL;
 	KML_File*      kfil=NULL;
 
@@ -30,47 +25,34 @@
 /*  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,
+		if      (!strncmp(kstr,"<?xml"    ,5)) {
+			kxml=new KML_File();
+			KMLFileTagAttrib(kxml,
 							 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;
 		}
-		if (!strncmp(kstr,"<kml",4)) {
+		else if (!strncmp(kstr,"<!DOCTYPE",9)) {
+			kdtd=new KML_File();
+			KMLFileTagAttrib(kdtd,
+							 kstr);
+		}
+		else if (!strncmp(kstr,"<kml"     ,4)) {
 			kfil=new KML_File();
 			kfil->Read(fid,kstr);
 //			kfil->DeepEcho();
-			kobj=kfil;
 		}
 
 //		_printf_(true,"%s\n",kstr);
 		xfree((void**)&kstr);
+	}
+
+	if (kxml) {
+		_printf_(true,"XML declaration:\n");
+		kxml->DeepEcho("  ");
+		delete kxml;
+	}
+	if (kdtd) {
+		_printf_(true,"DTD declaration (not yet implemented):\n");
+		kdtd->DeepEcho("  ");
+		delete kdtd;
 	}
 
@@ -80,5 +62,5 @@
 			 ((double)(clock1-clock0))/CLOCKS_PER_SEC,difftime(time1,time0));
 
-	return(kobj);
+	return(kfil);
 }
 
