fixed 2 problems raised by #152140, one which is that notation not in the

* valid.c xmlsave.c: fixed 2 problems raised by #152140, one
  which is that notation not in the internal subset should
  not be saved, and the second more nasty on an error saving
  NOTATIONs, if there is a proof that nobody uses notations !
Daniel
diff --git a/xmlsave.c b/xmlsave.c
index 1e8e0d7..398f62a 100644
--- a/xmlsave.c
+++ b/xmlsave.c
@@ -517,14 +517,18 @@
 	xmlBufferWriteQuotedString(buf->buffer, dtd->SystemID);
     }
     if ((dtd->entities == NULL) && (dtd->elements == NULL) &&
-            (dtd->attributes == NULL) && (dtd->notations == NULL) &&
-	    (dtd->pentities == NULL)) {
+        (dtd->attributes == NULL) && (dtd->notations == NULL) &&
+	(dtd->pentities == NULL)) {
 	xmlOutputBufferWrite(buf, 1, ">");
 	return;
     }
     xmlOutputBufferWrite(buf, 3, " [\n");
-    /* Dump the notations first they are not in the DTD children list */
-    if (dtd->notations != NULL) {
+    /*
+     * Dump the notations first they are not in the DTD children list
+     * Do this only on a standalone DTD or on the internal subset though.
+     */
+    if ((dtd->notations != NULL) && ((dtd->doc == NULL) ||
+        (dtd->doc->intSubset == dtd))) {
         xmlDumpNotationTable(buf->buffer, (xmlNotationTablePtr) dtd->notations);
     }
     format = ctxt->format;