Project

Profile

Help

Bug #4356

closed

XPathProcessor missing methods

Added by O'Neil Delpratt over 4 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Normal
Category:
C++ API
Start date:
2019-10-22
Due date:
% Done:

100%

Estimated time:
Found in version:
1.2.0
Fixed in version:
1.2.1
Platforms:

Description

Following the bug issue #4351 it has showed up that the XPathProcessor is missing some other key methods which would make it work in similar way as the XPathCompiler on Java:

  • setAllowUndeclaredVariables
  • declareVariable (already discussed in bug issue #4351 )
  • declareVariable(QName qname, ItemType itemType, OccurrenceIndicator occurrences)
  • setCaching
  • importSchemaNamespace(String uri)

Related issues

Related to SaxonC - Bug #4351: set_parameter failing under PyXPathProcessorClosedO'Neil Delpratt2019-10-19

Actions
Actions #1

Updated by O'Neil Delpratt over 4 years ago

  • Status changed from New to In Progress

Added methods in the APIs: C++, PHP and Python. Available for the next maintenance release

Adding unit tests.

Actions #2

Updated by O'Neil Delpratt over 4 years ago

  • Status changed from In Progress to Resolved
  • % Done changed from 0 to 100

Given that we are supporting languages that are not strongly typed we have decided to automatically set the setAllowUndeclaredVariables(true) upon creation of the XPathProcessor. Therefore we don't need to make available the methods declareVariable and setAllowUndeclaredVariable in C++, PHP and Python. If a variable is used but not set a error will occur.

Added unit tests.

Actions #3

Updated by O'Neil Delpratt over 4 years ago

  • Related to Bug #4351: set_parameter failing under PyXPathProcessor added
Actions #4

Updated by O'Neil Delpratt over 4 years ago

As a result the following sample test case will work:

def test_declare_variable_value(saxonproc):
    s1 = 'This is a test.'
    xdm_string_value = saxonproc.make_string_value(s1)

    xpath_processor = saxonproc.new_xpath_processor()
    xpath_processor.set_parameter('s1', xdm_string_value)
    result = xpath_processor.evaluate('$s1')

    assert result is not None
    assert 'test.' in result.head.string_value
Actions #5

Updated by O'Neil Delpratt over 4 years ago

  • Status changed from Resolved to Closed
  • Fixed in version set to 1.2.1

Bug fix applied in the Saxon/C maintenance release 1.2.1

Please register to edit this issue

Also available in: Atom PDF