diff --git a/src/xercesc/framework/StdOutFormatTarget.cpp b/src/xercesc/framework/StdOutFormatTarget.cpp
index 899169684fd09c04da1a77b9cae89414d9da8bf1..585cf8cb593df2a75c8e4c3a341753c4f43b5b5e 100644
--- a/src/xercesc/framework/StdOutFormatTarget.cpp
+++ b/src/xercesc/framework/StdOutFormatTarget.cpp
@@ -57,6 +57,9 @@
 /*
  * $Id$
  * $Log$
+ * Revision 1.7  2003/05/29 11:18:37  gareth
+ * Added macros in so we can determine whether to do things like iostream as opposed to iostream.h and whether to use std:: or not.
+ *
  * Revision 1.6  2003/01/24 20:20:22  tng
  * Add method flush to XMLFormatTarget
  *
@@ -80,7 +83,12 @@
  */
 
 #include <xercesc/framework/StdOutFormatTarget.hpp>
+
+#if defined(XERCES_NEW_IOSTREAMS)
+#include <iostream>
+#else
 #include <iostream.h>
+#endif
 
 XERCES_CPP_NAMESPACE_BEGIN
 
@@ -92,7 +100,7 @@ StdOutFormatTarget::~StdOutFormatTarget()
 
 void StdOutFormatTarget::flush()
 {
-    cout.flush();
+    XERCES_STD_QUALIFIER cout.flush();
 }
 
 void StdOutFormatTarget::writeChars(const XMLByte* const  toWrite
@@ -104,8 +112,8 @@ void StdOutFormatTarget::writeChars(const XMLByte* const  toWrite
         // Without the cast, it was printing the pointer value in hex.
         // Quite annoying, considering every other platform printed
         // the string with the explicit cast to char* below.
-    cout.write((char *) toWrite, (int) count);
-    cout.flush();
+    XERCES_STD_QUALIFIER cout.write((char *) toWrite, (int) count);
+    XERCES_STD_QUALIFIER cout.flush();
 
 }
 
diff --git a/src/xercesc/util/Compilers/CSetDefs.hpp b/src/xercesc/util/Compilers/CSetDefs.hpp
index ff73023e35d8f45bb09b7808a9db85b145b94b92..70ca28684347b98753922c347e327f5a01aebafc 100644
--- a/src/xercesc/util/Compilers/CSetDefs.hpp
+++ b/src/xercesc/util/Compilers/CSetDefs.hpp
@@ -56,6 +56,9 @@
 
 /*
  * $Log$
+ * Revision 1.7  2003/05/29 11:18:37  gareth
+ * Added macros in so we can determine whether to do things like iostream as opposed to iostream.h and whether to use std:: or not.
+ *
  * Revision 1.6  2002/11/05 21:43:55  tng
  * Turn on C++ Namespace support only if using AIX xlC version 4 or higher.
  *
@@ -193,6 +196,10 @@ typedef int             XMLInt32;
 #define XERCES_DEBUG
 #endif
 
+#if __IBMCPP__ >= 400
+#define XERCES_NEW_IOSTREAMS
+#define XERCES_STD_NAMESPACE
+#endif
 
 // ---------------------------------------------------------------------------
 //  Provide some common string ops that are different/notavail on CSet
diff --git a/src/xercesc/util/Compilers/GCCDefs.hpp b/src/xercesc/util/Compilers/GCCDefs.hpp
index 4beac0decf7bc0f539609f8101997911cbb55f37..99796bdddbc781d8a6a40d8e088ee66dc56cbfe1 100644
--- a/src/xercesc/util/Compilers/GCCDefs.hpp
+++ b/src/xercesc/util/Compilers/GCCDefs.hpp
@@ -56,6 +56,9 @@
 
 /*
  * $Log$
+ * Revision 1.7  2003/05/29 11:18:37  gareth
+ * Added macros in so we can determine whether to do things like iostream as opposed to iostream.h and whether to use std:: or not.
+ *
  * Revision 1.6  2002/11/18 20:38:11  tng
  * [Bug 14612] GCCDefs clashes with cygwin's string.h for stricmp and strnicmp.
  *
@@ -197,6 +200,10 @@ typedef int             XMLInt32;
 #define XERCES_DEBUG
 #endif
 
+#if __GNUC__ >= 3
+#define XERCES_NEW_IOSTREAMS
+#define XERCES_STD_NAMESPACE
+#endif
 
 // ---------------------------------------------------------------------------
 //  Provide some common string ops that are different/notavail on GCC
diff --git a/src/xercesc/util/Compilers/SunCCDefs.hpp b/src/xercesc/util/Compilers/SunCCDefs.hpp
index 6989ba309d5825c6dffa22fc9663d395cc49d2f7..082192b4b76f88122e49ea74d9ac95fb3aeaf09a 100644
--- a/src/xercesc/util/Compilers/SunCCDefs.hpp
+++ b/src/xercesc/util/Compilers/SunCCDefs.hpp
@@ -56,6 +56,9 @@
 
 /*
  * $Log$
+ * Revision 1.6  2003/05/29 11:18:37  gareth
+ * Added macros in so we can determine whether to do things like iostream as opposed to iostream.h and whether to use std:: or not.
+ *
  * Revision 1.5  2002/11/04 14:45:20  tng
  * C++ Namespace Support.
  *
@@ -196,6 +199,10 @@ typedef int             XMLInt32;
 #define XERCES_DEBUG
 #endif
 
+#if __SUNPRO_CC >= 0x500
+#define XERCES_NEW_IOSTREAMS
+#define XERCES_STD_NAMESPACE
+#endif
 
 // ---------------------------------------------------------------------------
 //  Provide some common string ops that are different/notavail on CC
diff --git a/src/xercesc/util/Compilers/VCPPDefs.hpp b/src/xercesc/util/Compilers/VCPPDefs.hpp
index 080e76e119fc71c21d60985b1ccc8971b2922f52..46b74e757f1e16f32fe8b2b8ef86f9732302f80d 100644
--- a/src/xercesc/util/Compilers/VCPPDefs.hpp
+++ b/src/xercesc/util/Compilers/VCPPDefs.hpp
@@ -56,6 +56,9 @@
 
 /*
  * $Log$
+ * Revision 1.8  2003/05/29 11:18:37  gareth
+ * Added macros in so we can determine whether to do things like iostream as opposed to iostream.h and whether to use std:: or not.
+ *
  * Revision 1.7  2002/11/04 14:45:20  tng
  * C++ Namespace Support.
  *
@@ -204,6 +207,10 @@ typedef int             XMLInt32;
 #define XERCES_DEBUG
 #endif
 
+#if _MSV_VER > 1300
+#define XERCES_NEW_IOSTREAMS
+#define XERCES_STD_NAMESPACE
+#endif
 
 // ---------------------------------------------------------------------------
 //  The name of the DLL that is built by the Visual C++ version of the
diff --git a/src/xercesc/util/XercesDefs.hpp b/src/xercesc/util/XercesDefs.hpp
index 28ddb69f8c2931cb08451ef2b20713a33b80fe0f..476302b07779fcf445212a60f645312ba75b1437 100644
--- a/src/xercesc/util/XercesDefs.hpp
+++ b/src/xercesc/util/XercesDefs.hpp
@@ -56,6 +56,9 @@
 
 /*
  * $Log$
+ * Revision 1.15  2003/05/29 11:18:37  gareth
+ * Added macros in so we can determine whether to do things like iostream as opposed to iostream.h and whether to use std:: or not.
+ *
  * Revision 1.14  2003/05/12 09:44:19  gareth
  * Port to NetBSD. Patch by Hiramatsu Yoshifumi.
  *
@@ -452,6 +455,15 @@ typedef XMLUInt32           UCS4Ch;
     #define XERCES_CPP_NAMESPACE_QUALIFIER
 #endif
 
+#if defined(XERCES_STD_NAMESPACE)
+	#define XERCES_USING_STD(NAME) using std :: NAME;
+	#define XERCES_STD_QUALIFIER  std ::
+#else
+	#define XERCES_USING_STD(NAME)
+	#define XERCES_STD_QUALIFIER 
+#endif
+
+
 // ---------------------------------------------------------------------------
 //  Set up the import/export keyword  for our core projects. The
 //  PLATFORM_XXXX keywords are set in the per-development environment