Hi,
I've been working on a problem with Xerces 2.4.0 together with Xerces 1.7.0. 

When I use an unc path as the input parameter of the constructor of Xalan's 
XSLTInputSource( const char* )
on Win98 systems Xerces raises the error:

The primary document entitiy could not be opened. Id=\\server\shared\..path-to-xml-file



I traced through Xerces' code an found that
- the constructor of Xerces' InputSource( const XMLCh* const SystemId, MemoryManager*) 
 is called internally and the systemId is file://///server/shared/...
- later in Win32PlatformUtils.cpp the Windows API method CreateFileA is called and 
tmpName is //server/shared/...
  BUT: CreateFileA can't open an UNC-Path with forward slashes on both Win98-PCs that 
I have tested (Win98 1st and 2nd Edition).

Isn't it unfriendly that the error message reports the file-to-open-path with back 
slashes?


I fixed the problem by patching 
xerces/src/xercesc/util/Platforms/Win32/Win32PlatformUtils.cpp (Xerces version 2.5.0) 
in method
openFile(const XMLCh* const fileName, MemoryManager* const manager). 
Here is my code beginning with line 326:
    else
    {
        //
        //  We are Win 95 / 98.  Take the Unicode file name back to (char *)
        //    so that we can open it.
        //
        char* tmpName = XMLString::transcode(nameToOpen, manager);
        
        //
        // this is my Win98-patch: I'm replacing all forward slashes by backward 
slashes
        //
        int len = strlen(tmpName);
        for ( int i = 0; i < len; ++i )
        {
                if ( tmpName[i] == '/' )
                        tmpName[i] = '\\';
        }
        
        retVal = ::CreateFileA
            (
            tmpName
            , GENERIC_READ
            , FILE_SHARE_READ
            , 0
            , OPEN_EXISTING
            , FILE_FLAG_SEQUENTIAL_SCAN
            , 0
            );
        manager->deallocate(tmpName);//delete [] tmpName;
    }


Do You think I am right? Do You also think this is a good and easy way of getting rid 
of the problem?
I hope that You will and can reproduce the problem and call it a bug (even if 
microsoft's implementation of CreateFileA is bad here). 

Please let me know wether You are going to do something as soon as possible. 
Our software is used by about 4000 Customers and some of them (about 1%) already have 
reported the problem. That's why I've been working on it for some months. We are going 
to distribute a new service pack of our software in about two weeks and I will use my 
patch if you agree.

Thanks,
Florian Nowotny,

software engineer, Frankfurt am Main (Germany)





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to