Message:

  A new issue has been created in JIRA.

---------------------------------------------------------------------
View the issue:
  http://issues.apache.org/jira/browse/XERCESC-1205

Here is an overview of the issue:
---------------------------------------------------------------------
        Key: XERCESC-1205
    Summary: primary document entity could not be opened - on Win98
       Type: Bug

     Status: Unassigned
   Priority: Major

    Project: Xerces-C++
 Components: 
             Utilities
   Versions:
             2.1.0
             2.4.0
             2.5.0

   Assignee: 
   Reporter: Florian Nowotny

    Created: Wed, 5 May 2004 1:11 AM
    Updated: Wed, 5 May 2004 1:11 AM
Environment: Together with Xalan. I have had the bug on Win98 (1st and 2nd edition). 
Reading the code I think Win95 and WinME may have the same problem.

Description:
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).

It's 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);
        
        //
        // Bugfix: 
        // I'm replacing all forward slashes with 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;
    }




---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.

If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa

If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


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

Reply via email to