Index: xmlIO.c
===================================================================
--- xmlIO.c	(revision 3647)
+++ xmlIO.c	(working copy)
@@ -3493,7 +3493,6 @@
     char *ret = NULL;
     char dir[1024];
     char *cur;
-    char sep = '/';
 
 #ifdef _WIN32_WCE  /* easy way by now ... wince does not have dirs! */
     return NULL;
@@ -3503,20 +3502,30 @@
 	xmlRegisterDefaultInputCallbacks();
 
     if (filename == NULL) return(NULL);
+
+/* On windows both flavours of separators are valid
+   <rs 2007-08-07>
+*/
 #if defined(WIN32) && !defined(__CYGWIN__)
-    sep = '\\';
+#   define IS_XMLPGD_SEP(ch) ((ch=='/')||(ch=='\\'))
+#else
+#   define IS_XMLPGD_SEP(ch) (ch=='/')
 #endif
 
     strncpy(dir, filename, 1023);
     dir[1023] = 0;
     cur = &dir[strlen(dir)];
     while (cur > dir) {
-         if (*cur == sep) break;
+         if (IS_XMLPGD_SEP(*cur)) break;
 	 cur --;
     }
-    if (*cur == sep) {
+    if (IS_XMLPGD_SEP(*cur)) {
         if (cur == dir) dir[1] = 0;
-	else *cur = 0;
+#if defined(WIN32) && !defined(__CYGWIN__)
+/* On windows root can be at drive letter, better not go below... */
+        else if ((cur == dir+2)&&(dir[1]==':')) dir[3] = 0;
+#endif
+        else *cur = 0;
 	ret = xmlMemStrdup(dir);
     } else {
         if (getcwd(dir, 1024) != NULL) {
@@ -3525,6 +3534,7 @@
 	}
     }
     return(ret);
+#undef IS_XMLPGD_SEP
 }
 
 /****************************************************************
