You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use of xs:integer() on right side of arrow operator seems to give error "elementpath.exceptions.ElementPathTypeError: 'xs:integer' constructor function at line 1, column 37: [err:XPST0017] Wrong number of arguments"
#83
Closed
martin-honnen opened this issue
Dec 18, 2024
· 3 comments
from elementpath import select
from elementpath.xpath3 import XPath3Parser
from xml.etree import ElementTree
root = ElementTree.XML('<root><term>12.</term></root>')
result = select(root, "term", parser=XPath3Parser)
print(result)
result = select(root, "term => substring-before('.') => xs:integer()", parser=XPath3Parser)
print(result)
which fails on the second select call with the traceback shown below.
I think in terms of XPath 3.1 the expression term => substring-before('.') => xs:integer() is fine.
Traceback (most recent call last):
File "C:\Users\marti\PycharmProjects\ElementPathArrowOperatorTest1\arrow-operator-test2.py", line 13, in <module>
result = select(root, "term => substring-before('.') => xs:integer()", parser=XPath3Parser)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\marti\PycharmProjects\ElementPathArrowOperatorTest1\.venv\Lib\site-packages\elementpath\xpath_selectors.py", line 53, in select
root_token = _parser.parse(path)
^^^^^^^^^^^^^^^^^^^
File "C:\Users\marti\PycharmProjects\ElementPathArrowOperatorTest1\.venv\Lib\site-packages\elementpath\xpath2\xpath2_parser.py", line 508, in parse
root_token = super(XPath1Parser, self).parse(source)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\marti\PycharmProjects\ElementPathArrowOperatorTest1\.venv\Lib\site-packages\elementpath\tdop.py", line 497, in parse
root_token = self.expression()
^^^^^^^^^^^^^^^^^
File "C:\Users\marti\PycharmProjects\ElementPathArrowOperatorTest1\.venv\Lib\site-packages\elementpath\tdop.py", line 627, in expression
left = self.token.led(left)
^^^^^^^^^^^^^^^^^^^^
File "C:\Users\marti\PycharmProjects\ElementPathArrowOperatorTest1\.venv\Lib\site-packages\elementpath\xpath31\_xpath31_operators.py", line 242, in led_arrow_operator
self[:] = left, self.parser.expression(80)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\marti\PycharmProjects\ElementPathArrowOperatorTest1\.venv\Lib\site-packages\elementpath\tdop.py", line 627, in expression
left = self.token.led(left)
^^^^^^^^^^^^^^^^^^^^
File "C:\Users\marti\PycharmProjects\ElementPathArrowOperatorTest1\.venv\Lib\site-packages\elementpath\xpath1\_xpath1_operators.py", line 186, in led
self[:] = left, self.parser.expression(95)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\marti\PycharmProjects\ElementPathArrowOperatorTest1\.venv\Lib\site-packages\elementpath\tdop.py", line 624, in expression
left = self.token.nud()
^^^^^^^^^^^^^^^^
File "C:\Users\marti\PycharmProjects\ElementPathArrowOperatorTest1\.venv\Lib\site-packages\elementpath\xpath2\xpath2_parser.py", line 260, in nud_
raise self.error('XPST0017') from None
elementpath.exceptions.ElementPathTypeError: 'xs:integer' constructor function at line 1, column 37: [err:XPST0017] Wrong number of arguments
The text was updated successfully, but these errors were encountered:
I have the Python script
which fails on the second
select
call with the traceback shown below.I think in terms of XPath 3.1 the expression
term => substring-before('.') => xs:integer()
is fine.The text was updated successfully, but these errors were encountered: