On Mon, Jan 18, 2010 at 9:54 AM, Boris Kolpackov
<[email protected]> wrote:
> The thing with setExternalSchemaLocation is that the schema path will be
> resolved relative to the XML file being parsed unless it is an absolute
> URI (in the file:/// form in case of a filesystem path). This page has
> some more information:
>
> http://www.codesynthesis.com/projects/xsd/documentation/cxx/tree/guide/#5.1
>
> Boris
Yes, that was the problem I recently had. I've successfully been able
to load my own XSD by overriding an EntityResolver. Seems to work for
me.
class RFIDResolver : public EntityResolver {
public :
InputSource* resolveEntity(const XMLCh* const publicId, const
XMLCh* const systemId)
{
CStr2XStr path("/home/dfcuser/rfid.xsd");
if (XMLString::compareString(systemId, path.unicodeForm())) {
return new LocalFileInputSource(path.unicodeForm());
} else {
return 0;
}
}
};
...
RFIDResolver *rfidResolver = new RFIDResolver();
parser->setEntityResolver(rfidResolver);
--
Kelly Beard