You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by mkrevuelta <mk...@gmail.com> on 2016/01/29 14:50:43 UTC

Re: unable to open primary document entity in Xerces 301

Hi,

I am using Xerces 3.1.2.12 on Windows 7, 64 bits.

I suffered the same problem, so I debugged the code and found out that
Xerces is trying to open the file in mode FILE_SHARE_READ only. That is,
sharing for readers, but in exclusive mode with respect to writers.

When the machine is too busy, Windows takes some time to make that operation
available after the file has been open for writing. I've verified that calls
to the win32 API function CreateFile() with FILE_SHARE_READ (which opens
and/or creates a file) return INVALID_HANDLE_VALUE for a short while.

The workaround is to try to open the file in FILE_SHARE_READ mode _before_
calling Xerces. If it returns INVALID_HANDLE_VALUE and you know the file
exists, sleep for a short while and try again. Repeat several times with
increasing sleep times until you get tired.

Cheers,
Martin




--
View this message in context: http://apache-xml-project.6118.n7.nabble.com/Xerces-C-2-8-0-released-tp17353p42484.html
Sent from the Xerces - C - Dev mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org