Project

Profile

Help

Bug #6351

closed

Getting the line number is not available via the API on XdmNode

Added by O'Neil Delpratt 10 months ago. Updated 5 months ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
SaxonC API
Start date:
2024-02-17
Due date:
% Done:

100%

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

Description

Reported by user here: https://stackoverflow.com/questions/78008394/how-do-i-get-the-line-numbers-of-a-saxonc-xpath-match/78009287#78009287

There is no straight forward way to get the line number on a XdmNode in C++, PHP and Python.

For example, the Python PyXdmNode (see: https://www.saxonica.com/saxon-c/doc12/html/saxonc.html#PyXdmNode) currently does not support getting line numbers as its Java equivalent class XdmNode: https://www.saxonica.com/html/documentation12/javadoc/net/sf/saxon/s9api/XdmNode.html#getLineNumber()

Actions #1

Updated by O'Neil Delpratt 10 months ago

The workaround is as follows:

        xpath_processor.set_context(xdm_item=item)
        print(item, xpath_processor.evaluate_single('saxon:line-number(.)'))
Actions #2

Updated by Martin Honnen 10 months ago

If line number gets exposed in the C++, Python and PHP API, I think the column number https://www.saxonica.com/html/documentation12/javadoc/net/sf/saxon/s9api/XdmNode.html#getColumnNumber() should be exposed as well, for completeness.

Actions #3

Updated by O'Neil Delpratt 10 months ago

  • Status changed from New to In Progress
  • % Done changed from 0 to 90

The methods getLinenumber() and getColumnNumber() have been added to the the XdmNode on C++, Python and PHP APIs.

Tests cases added. But still doing some testing on PHP.

Actions #4

Updated by O'Neil Delpratt 7 months ago

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

Issue reviewed. We now have unit tests for PHP.

Actions #5

Updated by O'Neil Delpratt 5 months ago

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

Bug fix applied in the Saxon 12.5 Maintenance release.

Actions #6

Updated by Community Admin 5 months ago

  • Fix Committed on Branch 12 added

Please register to edit this issue

Also available in: Atom PDF