tags:

views:

251

answers:

2

I'm transforming an XML document by using Xerces-C 2.5 and Xalan-C 1.8. The XSL contains a "document" function, that references a file on the network. Unfortunately I cannot access this file by HTTP. I've only got the UNC path.

Xerces refuses to parse the referenced document, because WinSockNetAccessor::makeNew is called in Xerces as the "file" protocol is only accepted for local files. WinSockNetAccessor::makeNew is implemented for HTTP only, an exception is thrown and the file is ignored.

Is there a way to fool Xerces in order to accept the unc path as local file or any other known workaround without writing my own parser or manipulating Xerces?

+1  A: 

A simple workaround would be, I guess, to just create a mapping, so you can call the network drive O: or whatever. That often fools programs that can't work directly with a UNC path (such as cmd.exe itself).

unwind
There is no "fooling" involved. A mapped network drive is no UNC path. All network related activity is taken care of by the redirector, any local program will see just a default drive (with a non-default type, though, but most programs don't ask).
Tomalak
A: 

Does the UNC as it appears in the XSL have a "file:" prefix?

BTW, Xerces C V2.5 is several years old. Have you tried the latest version - V3.0.1 at the moment?

jon hanson
Xerces "normalises" the URI anyway and the result is the same for "file://\\pc4711...", "\\pc4711...". BTW: MSXML instead is reacting differently for the both terms and MSXML will be the choice, if I have to change the parser. But you are totally right, the answer is: Don't use this old scrap.