Guys,
you have missed to port XMLPlatformUtils::getBasePath() function.
The XMLPlatformUtils::getFullPath() functions returns the fully qualified
name of input suource rather than full path. e.g. For input file
F:\sample\a.xml it will return F:\sample\a.xml, rather than F:\sample.
Relative path is calculated incorrect.
For example, suppose we have the directory with sample xml files
(F:\sample).
If you run your parser from different location (suppose from root D:\) and
give it an input file from that directory then:
1. You give it a standalone file
D:\> parser.exe -i f:\sample\a1.xml
It parses ok
2. You give it a file with reference to dtd that is located in the same
directory (F:\samples\a2.dtd)
D:\> parser.exe -i f:\sample\a2.xml
It will end up with error
An exception occured! Type:RuntimeException, Message:Could not open DTD file
'D:\a2.dtd'
Here the code where it happens:
LocalFileInputSource::LocalFileInputSource(const XMLCh* const filePath)
{
//
// If the path is relative, then complete it acording to the current
// working directory rules of the current platform. Else, just take
// it as is.
//
if (XMLPlatformUtils::isRelative(filePath))
{
XMLCh* tmpBuf = XMLPlatformUtils::getFullPath(filePath);
setSystemId(tmpBuf);
delete [] tmpBuf;
}
else
{
setSystemId(filePath);
}
}
The function XMLPlatformUtils::getFullPath(filePath) retunrs the path
relative to the directory where the parser was run from.
In the previous version (XML4C2.3.1) you provided getBasePath() function,
which I used to get the base path
(F:\samples) of the input file. Later, in derived expandSystemId() I made
myself a path to the dtd file as:
rememberedBasePath + systemId
So, please return this function back or make an appropriate changes in
getFullPath function.
Thanks,
Peter A. Volchek
Software Engineer
Metis International, Inc.
[EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]