Index: src/edu/ucsb/nceas/metacat/MetaCatServlet.java
===================================================================
--- src/edu/ucsb/nceas/metacat/MetaCatServlet.java	(revision 4501)
+++ src/edu/ucsb/nceas/metacat/MetaCatServlet.java	(revision 4502)
@@ -30,7 +30,6 @@
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileReader;
-import java.io.FileWriter;
 import java.io.IOException;
 import java.io.OutputStreamWriter;
 import java.io.PrintWriter;
@@ -65,7 +64,7 @@
 
 import org.apache.log4j.Logger;
 import org.apache.log4j.PropertyConfigurator;
-//import org.ecoinformatics.eml.EMLParser;
+import org.ecoinformatics.eml.EMLParser;
 
 import au.com.bytecode.opencsv.CSVWriter;
 
@@ -1717,7 +1716,6 @@
             ZipOutputStream zout, boolean withInlineData, Hashtable<String, String[]> params)
             throws ClassNotFoundException, IOException, SQLException,
             McdbException, Exception {
-    	String documentDir = PropertyService.getProperty("application.documentfilepath");
     	
         Logger logMetacat = Logger.getLogger(MetaCatServlet.class);
         try {
@@ -1802,22 +1800,16 @@
                     
                     // Try to get the metadata file from disk. If it isn't
 					// found, create it from the db and write it to disk then.
-					String documentPath = documentDir + FileUtil.getFS() + docid;
 					try {
-						if (FileUtil.getFileStatus(documentPath) == FileUtil.DOES_NOT_EXIST) {
-							FileWriter fileWriter = new FileWriter(documentPath);
-							doc.toXml(fileWriter, user, groups, withInlineData);
-						}
-						
 						PrintWriter out = new PrintWriter(streamOut);
-						doc.readFromFileSystem(out, user, groups, documentPath);				
+						doc.toXml(out, user, groups, withInlineData);				
 					} catch (Exception e) {
 						// any exceptions in reading the xml from disc, and we go back to the
 						// old way of creating the xml directly.
-						logMetacat.error("could not read from document file " + documentPath 
+						logMetacat.error("could not read from document file " + docid 
 								+ ": " + e.getMessage());
 						PrintWriter out = new PrintWriter(streamOut);
-						doc.toXml(out, user, groups, withInlineData);
+						doc.toXmlFromDb(out, user, groups, withInlineData);
 					}
                 } else {
                 	// TODO MCD, this should read from disk as well?
@@ -2135,7 +2127,7 @@
                             // set eml2 base	 validation parser
                             String rule = DocumentImpl.EML200;
                             // using emlparser to check id validation
-//                            EMLParser parser = new EMLParser(doctext[0]);
+                            EMLParser parser = new EMLParser(doctext[0]);
                             documentWrapper = new DocumentImplWrapper(rule, true);
                         } else if (namespace.compareTo(
                                 DocumentImpl.EML2_1_0NAMESPACE) == 0) {
@@ -2142,7 +2134,7 @@
                             // set eml2 base validation parser
                             String rule = DocumentImpl.EML210;
                             // using emlparser to check id validation
-//                            EMLParser parser = new EMLParser(doctext[0]);
+                            EMLParser parser = new EMLParser(doctext[0]);
                             documentWrapper = new DocumentImplWrapper(rule, true);
                         } else {
                             // set schema base validation parser
@@ -2182,27 +2174,6 @@
 
                         newdocid = documentWrapper.write(dbConn, xml, pub, dtd,
                                 doAction, accNumber, user, groups);
-                        
-                        // write the document to disk
-						FileWriter fileWriter = null;
-						try {
-							String documentDir = 
-								PropertyService.getProperty("application.documentfilepath");
-							String documentPath = documentDir + FileUtil.getFS() + accNumber;
-
-							if (accNumber != null
-									&& FileUtil.getFileStatus(documentPath) == FileUtil.DOES_NOT_EXIST) {
-								fileWriter = new FileWriter(documentPath);
-								fileWriter.write(doctext[0]);
-							}
-						} catch (IOException ioe) {
-							logMetacat.error("Did not write " + accNumber
-									+ " to file system: " + ioe.getMessage());
-						} finally {
-							if (fileWriter != null) {
-								fileWriter.close();
-							}
-						}
                                 
                         EventLog.getInstance().log(request.getRemoteAddr(),
                                 user, accNumber, action[0]);
