Project

Profile

Help

Bug #5546

closed

Calling setCatalog in the SaxonC PHP extension throws an error

Added by Alf Eaton over 2 years ago. Updated over 2 years ago.

Status:
Closed
Priority:
Normal
Category:
C++ API
Start date:
2022-05-27
Due date:
% Done:

100%

Estimated time:
Applies to branch:
Fix Committed on Branch:
Fixed in Maintenance Release:
Found in version:
11.3
Fixed in version:
11.4
SaxonC Languages:
SaxonC Platforms:
SaxonC Architecture:

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

Actions #1

Updated by O'Neil Delpratt over 2 years ago

  • 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.

Actions #2

Updated by O'Neil Delpratt over 2 years ago

  • 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();
    }
}

Actions #3

Updated by O'Neil Delpratt over 2 years ago

  • 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