--- a/ext/dom/node.c.orig	2010-05-01 13:30:38.000000000 -0500
+++ b/ext/dom/node.c	2013-05-09 20:34:37.000000000 -0500
@@ -1950,9 +1950,17 @@
         RETVAL_FALSE;
     } else {
 		if (mode == 0) {
+#ifdef LIBXML2_NEW_BUFFER
+            ret = xmlOutputBufferGetSize(buf);
+#else
 			ret = buf->buffer->use;
+#endif
 			if (ret > 0) {
+#ifdef LIBXML2_NEW_BUFFER
+                RETVAL_STRINGL((char *) xmlOutputBufferGetContent(buf), ret, 1);
+#else
 				RETVAL_STRINGL((char *) buf->buffer->content, ret, 1);
+#endif
 			} else {
 				RETVAL_EMPTY_STRING();
 			}
--- a/ext/dom/documenttype.c.orig	2010-01-03 03:23:27.000000000 -0600
+++ b/ext/dom/documenttype.c	2013-05-09 20:34:37.000000000 -0500
@@ -215,7 +215,13 @@
 		if (buff != NULL) {
 			xmlNodeDumpOutput (buff, NULL, (xmlNodePtr) intsubset, 0, 0, NULL);
 			xmlOutputBufferFlush(buff);
+
+#ifdef LIBXML2_NEW_BUFFER
+			ZVAL_STRINGL(*retval, xmlOutputBufferGetContent(buff),
+			             xmlOutputBufferGetSize(buff), 1);
+#else
 			ZVAL_STRINGL(*retval, buff->buffer->content, buff->buffer->use, 1);
+#endif
 			(void)xmlOutputBufferClose(buff);
 			return SUCCESS;
 		}
--- a/ext/simplexml/simplexml.c.orig	2010-05-05 06:40:11.000000000 -0500
+++ b/ext/simplexml/simplexml.c	2013-05-09 20:34:37.000000000 -0500
@@ -1343,7 +1343,12 @@
 
 			xmlNodeDumpOutput(outbuf, (xmlDocPtr) sxe->document->ptr, node, 0, 0, ((xmlDocPtr) sxe->document->ptr)->encoding);
 			xmlOutputBufferFlush(outbuf);
+#ifdef LIBXML2_NEW_BUFFER
+			RETVAL_STRINGL((char *)xmlOutputBufferGetContent(outbuf),
+			               xmlOutputBufferGetSize(outbuf), 1);
+#else
 			RETVAL_STRINGL((char *)outbuf->buffer->content, outbuf->buffer->use, 1);
+#endif
 			xmlOutputBufferClose(outbuf);
 		}
 	} else {
