diff --git a/doc/symbols.xml b/doc/symbols.xml
index eeb049d4..a52202a2 100644
--- a/doc/symbols.xml
+++ b/doc/symbols.xml
@@ -1768,4 +1768,7 @@
xmlHashDefaultDeallocator
+
+ xmlPopOutputCallbacks
+
diff --git a/include/libxml/xmlIO.h b/include/libxml/xmlIO.h
index 8690d668..095b2f56 100644
--- a/include/libxml/xmlIO.h
+++ b/include/libxml/xmlIO.h
@@ -217,6 +217,8 @@ xmlParserInputBufferPtr
*/
XMLPUBFUN void XMLCALL
xmlCleanupOutputCallbacks (void);
+XMLPUBFUN int XMLCALL
+ xmlPopOutputCallbacks (void);
XMLPUBFUN void XMLCALL
xmlRegisterDefaultOutputCallbacks(void);
XMLPUBFUN xmlOutputBufferPtr XMLCALL
diff --git a/libxml2.syms b/libxml2.syms
index c17d3d98..33bc112c 100644
--- a/libxml2.syms
+++ b/libxml2.syms
@@ -2286,3 +2286,10 @@ LIBXML2_2.9.8 {
xmlHashDefaultDeallocator;
} LIBXML2_2.9.1;
+LIBXML2_2.9.11 {
+ global:
+
+# xmlIO
+ xmlPopOutputCallbacks;
+} LIBXML2_2.9.8;
+
diff --git a/xmlIO.c b/xmlIO.c
index 752d5e0a..b6384e76 100644
--- a/xmlIO.c
+++ b/xmlIO.c
@@ -560,6 +560,33 @@ xmlCleanupOutputCallbacks(void)
xmlOutputCallbackNr = 0;
xmlOutputCallbackInitialized = 0;
}
+
+/**
+ * xmlPopOutputCallbacks:
+ *
+ * Remove the top output callbacks from the output stack. This includes the
+ * compiled-in I/O.
+ *
+ * Returns the number of output callback registered or -1 in case of error.
+ */
+int
+xmlPopOutputCallbacks(void)
+{
+ if (!xmlOutputCallbackInitialized)
+ return(-1);
+
+ if (xmlOutputCallbackNr <= 0)
+ return(-1);
+
+ xmlOutputCallbackNr--;
+ xmlOutputCallbackTable[xmlOutputCallbackNr].matchcallback = NULL;
+ xmlOutputCallbackTable[xmlOutputCallbackNr].opencallback = NULL;
+ xmlOutputCallbackTable[xmlOutputCallbackNr].writecallback = NULL;
+ xmlOutputCallbackTable[xmlOutputCallbackNr].closecallback = NULL;
+
+ return(xmlOutputCallbackNr);
+}
+
#endif /* LIBXML_OUTPUT_ENABLED */
/************************************************************************