Bug #5546
closed
Calling setCatalog in the SaxonC PHP extension throws an error
Fixed in Maintenance Release:
Description
I'm in the process of upgrading to SaxonC 11.3, to use the PHP extension. When attempting to set the path to a catalog file using $saxonProcessor->setCatalog(…)
, an error is thrown:
Unable to find class net/sf/saxon/trans/XmlCatalogResolver
Error: Saxonc.setCatalog() not found
What's needed for the PHP extension to be able to find net/sf/saxon/trans/XmlCatalogResolver
?
I've tried the previous method of defining a different class, i.e.
$saxonProcessor->setConfigurationProperty('http://saxon.sf.net/feature/sourceParserClass', 'org.apache.xml.resolver.tools.ResolvingXMLReader')
but that doesn't seem to be possible any more.
There's a repository with code to reproduce this at https://github.com/hubgit/saxon-he-php-demo
- Category set to C++ API
- Assignee set to O'Neil Delpratt
- Priority changed from Low to Normal
- Found in version set to 11.3
Thanks for supplying the repo. The interface for the catalog API has changed on the Java side. I will update the JNI code to reflect this change.
- Status changed from New to Resolved
- % Done changed from 0 to 100
Bug fixed and committed to the git repository. Available for the next maintenance release.
Add unit test.
There is no workaround to this issue, but the user can update the SaxonProcessor.setCatalog method to get it working in their environment:
void SaxonProcessor::setCatalog(const char *catalogFile, bool isTracing) {
SaxonProcessor::attachCurrentThread();
static jmethodID catalogMID = SaxonProcessor::sxn_environ->env->GetMethodID(procClass, "setCatalogFiles",
"([Ljava/lang/String;)V");
if (!catalogMID) {
std::cerr << "\nError: Saxonc." << "setCatalogFiles()" << " not found" << std::endl;
return;
}
if (catalogFile == nullptr) {
return;
}
if (!proc) {
createException("Processor is null in SaxonProcessor.setCatalogFiles");
return;
}
SaxonProcessor::sxn_environ->env->CallVoidMethod(proc, catalogMID,
SaxonProcessor::sxn_environ->env->NewStringUTF(catalogFile));
if (exceptionOccurred()) {
createException();
}
}
- Status changed from Resolved to Closed
- Fixed in version set to 11.4
Bug fix applied in the SaxonC 11.4 maintenance release.
Please register to edit this issue
Also available in: Atom
PDF