Add a configure test for xmlReadMemory.

diff --git a/configure b/configure
index b1e0972..91f2d76 100755
--- a/configure
+++ b/configure
@@ -8818,6 +8818,78 @@
              XML2INCL="$ac_xml_cflags"
 fi
 
+         echo "$as_me:$LINENO: checking for xmlReadMemory in -lxml2" >&5
+echo $ECHO_N "checking for xmlReadMemory in -lxml2... $ECHO_C" >&6
+if test "${ac_cv_lib_xml2_xmlReadMemory+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lxml2  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char xmlReadMemory ();
+int
+main ()
+{
+xmlReadMemory ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_xml2_xmlReadMemory=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_xml2_xmlReadMemory=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_xml2_xmlReadMemory" >&5
+echo "${ECHO_T}$ac_cv_lib_xml2_xmlReadMemory" >&6
+if test $ac_cv_lib_xml2_xmlReadMemory = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_XMLREADMEMORY 1
+_ACEOF
+
+fi
+
+
 fi
 
 done
diff --git a/configure.ac b/configure.ac
index 016b0fc..50b40d9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -451,7 +451,10 @@
         [AC_CHECK_LIB(xml2, xmlParseMemory,
             [AC_DEFINE(HAVE_LIBXML2, 1, [Define if you have the libxml2 library])
              XML2LIBS="$ac_xml_libs"
-             XML2INCL="$ac_xml_cflags"],,$ac_xml_libs)])
+             XML2INCL="$ac_xml_cflags"],,$ac_xml_libs)
+         AC_CHECK_LIB(xml2, xmlReadMemory,
+            [AC_DEFINE(HAVE_XMLREADMEMORY,1,[Define if libxml2 has the xmlReadMemory function])])
+        ])
     CPPFLAGS="$ac_save_CPPFLAGS"
 fi
 
diff --git a/dlls/msxml3/domdoc.c b/dlls/msxml3/domdoc.c
index 23714fd..2e840f2 100644
--- a/dlls/msxml3/domdoc.c
+++ b/dlls/msxml3/domdoc.c
@@ -651,6 +651,20 @@
     return E_NOTIMPL;
 }
 
+static xmlDocPtr doparse( char *ptr, int len )
+{
+#ifdef HAVE_XMLREADMEMORY
+    /*
+     * use xmlReadMemory if possible so we can supress
+     * writing errors to stderr
+     */
+    return xmlReadMemory( ptr, len, NULL, NULL,
+                          XML_PARSE_NOERROR | XML_PARSE_NOWARNING );
+#else
+    return xmlParseMemory( ptr, len );
+#endif
+}
+
 static xmlDocPtr doread( LPWSTR filename )
 {
     HANDLE handle, mapping;
@@ -674,8 +688,7 @@
             ptr = MapViewOfFile( mapping, FILE_MAP_READ, 0, 0, len );
             if ( ptr )
             {
-                xmldoc = xmlReadMemory( ptr, len, NULL, NULL,
-                              XML_PARSE_NOERROR | XML_PARSE_NOWARNING );
+                xmldoc = doparse( ptr, len );
                 UnmapViewOfFile( ptr );
             }
             CloseHandle( mapping );
@@ -832,8 +845,7 @@
     if ( !bstr_to_utf8( bstrXML, &str, &len ) )
         return S_FALSE;
 
-    xmldoc = xmlReadMemory( str, len, NULL, NULL,
-                XML_PARSE_NOERROR | XML_PARSE_NOWARNING );
+    xmldoc = doparse( str, len );
     HeapFree( GetProcessHeap(), 0, str );
 
     This->node = create_domdoc_node( xmldoc );
diff --git a/include/config.h.in b/include/config.h.in
index 9218b11..48ae78e 100644
--- a/include/config.h.in
+++ b/include/config.h.in
@@ -812,6 +812,9 @@
 /* Define if you have the XKB extension */
 #undef HAVE_XKB
 
+/* Define if libxml2 has the xmlReadMemory function */
+#undef HAVE_XMLREADMEMORY
+
 /* Define if Xrender has the XRenderSetPictureTransform function */
 #undef HAVE_XRENDERSETPICTURETRANSFORM