applied patch from Alfred Mickautsch for better DTD support. fixed bug

* xmlwriter.c include/libxml/xmlwriter.h doc/* : applied patch from
  Alfred Mickautsch for better DTD support.
* SAX2.c HTMLparser.c parser.c xinclude.c xmllint.c xmlreader.c
  xmlschemas.c: fixed bug #137867 i.e. fixed properly the way
  reference counting is handled in the XML parser which had the
  side effect of removing a lot of hazardous cruft added to try
  to fix the problems associated as they popped up.
* xmlIO.c: FILE * close fixup for stderr/stdout
Daniel
diff --git a/xmlschemas.c b/xmlschemas.c
index 3a3602f..192cfe8 100644
--- a/xmlschemas.c
+++ b/xmlschemas.c
@@ -374,8 +374,8 @@
         return (NULL);
     }
     memset(ret, 0, sizeof(xmlSchema));
-    xmlDictReference(ctxt->dict);
     ret->dict = ctxt->dict;
+    xmlDictReference(ret->dict);
 
     return (ret);
 }