Added start/endDoctypeDeclHandlers
diff --git a/expat/expat.html b/expat/expat.html
index 28c0898..df434c1 100755
--- a/expat/expat.html
+++ b/expat/expat.html
@@ -9,7 +9,7 @@
 
 <H1>expat - XML Parser Toolkit</H1>
 
-<H3>Version 19990709</H3>
+<H3>Version 19990728</H3>
 
 <P>Copyright (c) 1998, 1999 James Clark.  Expat is subject to the <A
 HREF="http://www.mozilla.org/NPL/NPL-1_1Final.html">Mozilla Public
diff --git a/expat/xmlparse/xmlparse.c b/expat/xmlparse/xmlparse.c
index c1c011e..d9df3a8 100755
--- a/expat/xmlparse/xmlparse.c
+++ b/expat/xmlparse/xmlparse.c
@@ -300,6 +300,8 @@
   XML_StartCdataSectionHandler m_startCdataSectionHandler;
   XML_EndCdataSectionHandler m_endCdataSectionHandler;
   XML_DefaultHandler m_defaultHandler;
+  XML_StartDoctypeDeclHandler m_startDoctypeDeclHandler;
+  XML_EndDoctypeDeclHandler m_endDoctypeDeclHandler;
   XML_UnparsedEntityDeclHandler m_unparsedEntityDeclHandler;
   XML_NotationDeclHandler m_notationDeclHandler;
   XML_StartNamespaceDeclHandler m_startNamespaceDeclHandler;
@@ -364,6 +366,8 @@
 #define startCdataSectionHandler (((Parser *)parser)->m_startCdataSectionHandler)
 #define endCdataSectionHandler (((Parser *)parser)->m_endCdataSectionHandler)
 #define defaultHandler (((Parser *)parser)->m_defaultHandler)
+#define startDoctypeDeclHandler (((Parser *)parser)->m_startDoctypeDeclHandler)
+#define endDoctypeDeclHandler (((Parser *)parser)->m_endDoctypeDeclHandler)
 #define unparsedEntityDeclHandler (((Parser *)parser)->m_unparsedEntityDeclHandler)
 #define notationDeclHandler (((Parser *)parser)->m_notationDeclHandler)
 #define startNamespaceDeclHandler (((Parser *)parser)->m_startNamespaceDeclHandler)
@@ -452,6 +456,8 @@
   startCdataSectionHandler = 0;
   endCdataSectionHandler = 0;
   defaultHandler = 0;
+  startDoctypeDeclHandler = 0;
+  endDoctypeDeclHandler = 0;
   unparsedEntityDeclHandler = 0;
   notationDeclHandler = 0;
   startNamespaceDeclHandler = 0;
@@ -765,6 +771,14 @@
   defaultExpandInternalEntities = 1;
 }
 
+void XML_SetDoctypeDeclHandler(XML_Parser parser,
+			       XML_StartDoctypeDeclHandler start,
+			       XML_EndDoctypeDeclHandler end)
+{
+  startDoctypeDeclHandler = start;
+  endDoctypeDeclHandler = end;
+}
+
 void XML_SetUnparsedEntityDeclHandler(XML_Parser parser,
 				      XML_UnparsedEntityDeclHandler handler)
 {
@@ -2200,6 +2214,15 @@
 	enc = encoding;
       }
       break;
+    case XML_ROLE_DOCTYPE_NAME:
+      if (startDoctypeDeclHandler) {
+	const XML_Char *name = poolStoreString(&tempPool, enc, s, next);
+	if (!name)
+	  return XML_ERROR_NO_MEMORY;
+	startDoctypeDeclHandler(handlerArg, name);
+	poolClear(&tempPool);
+      }
+      break;
 #ifdef XML_DTD
     case XML_ROLE_TEXT_DECL:
       {
@@ -2256,6 +2279,8 @@
 	    && !notStandaloneHandler(handlerArg))
 	  return XML_ERROR_NOT_STANDALONE;
       }
+      if (endDoctypeDeclHandler)
+	endDoctypeDeclHandler(handlerArg);
       break;
     case XML_ROLE_INSTANCE_START:
       processor = contentProcessor;
diff --git a/expat/xmlparse/xmlparse.h b/expat/xmlparse/xmlparse.h
index 065ad03..284c317 100755
--- a/expat/xmlparse/xmlparse.h
+++ b/expat/xmlparse/xmlparse.h
@@ -137,6 +137,15 @@
 				   const XML_Char *s,
 				   int len);
 
+/* This is called for the start of the DOCTYPE declaration when the
+name of the DOCTYPE is encountered. */
+typedef void (*XML_StartDoctypeDeclHandler)(void *userData,
+					    const XML_Char *doctypeName);
+
+/* This is called for the start of the DOCTYPE declaration when the
+closing > is encountered, but after processing any external subset. */
+typedef void (*XML_EndDoctypeDeclHandler)(void *userData);
+
 /* This is called for a declaration of an unparsed (NDATA)
 entity.  The base argument is whatever was set by XML_SetBase.
 The entityName, systemId and notationName arguments will never be null.
@@ -309,6 +318,11 @@
 		            XML_DefaultHandler handler);
 
 void XMLPARSEAPI
+XML_SetDoctypeDeclHandler(XML_Parser parser,
+			  XML_StartDoctypeDeclHandler start,
+			  XML_EndDoctypeDeclHandler end);
+
+void XMLPARSEAPI
 XML_SetUnparsedEntityDeclHandler(XML_Parser parser,
 				 XML_UnparsedEntityDeclHandler handler);
 
diff --git a/expat/xmlwf/xmlwf.c b/expat/xmlwf/xmlwf.c
index 344108a..1297a0c 100755
--- a/expat/xmlwf/xmlwf.c
+++ b/expat/xmlwf/xmlwf.c
@@ -413,12 +413,30 @@
 }
 
 static
+void metaStartDoctypeDecl(XML_Parser parser, const XML_Char *doctypeName)
+{
+  FILE *fp = XML_GetUserData(parser);
+  ftprintf(fp, T("<startdoctype name=\"%s\""), doctypeName);
+  metaLocation(parser);
+  fputts(T("/>\n"), fp);
+}
+
+static
+void metaEndDoctypeDecl(XML_Parser parser)
+{
+  FILE *fp = XML_GetUserData(parser);
+  fputts(T("<enddoctype"), fp);
+  metaLocation(parser);
+  fputts(T("/>\n"), fp);
+}
+
+static
 void metaUnparsedEntityDecl(XML_Parser parser,
-			       const XML_Char *entityName,
-			       const XML_Char *base,
-			       const XML_Char *systemId,
-			       const XML_Char *publicId,
-			       const XML_Char *notationName)
+			    const XML_Char *entityName,
+			    const XML_Char *base,
+			    const XML_Char *systemId,
+			    const XML_Char *publicId,
+			    const XML_Char *notationName)
 {
   FILE *fp = XML_GetUserData(parser);
   ftprintf(fp, T("<entity name=\"%s\""), entityName);
@@ -687,6 +705,7 @@
 	XML_SetCommentHandler(parser, metaComment);
 	XML_SetCdataSectionHandler(parser, metaStartCdataSection, metaEndCdataSection);
 	XML_SetCharacterDataHandler(parser, metaCharacterData);
+	XML_SetDoctypeDeclHandler(parser, metaStartDoctypeDecl, metaEndDoctypeDecl);
 	XML_SetUnparsedEntityDeclHandler(parser, metaUnparsedEntityDecl);
 	XML_SetNotationDeclHandler(parser, metaNotationDecl);
 	XML_SetNamespaceDeclHandler(parser, metaStartNamespaceDecl, metaEndNamespaceDecl);