PyXdmNode.node_kind_str: should it return e.g. a Python string with text for text nodes or with text quoted e.g. 'text'?
Added by Martin Honnen almost 2 years ago
I am kind of confused (using SaxonC 11.99 HE) that node_kind_str
seems to return a string with e.g. 'element'
for element nodes or e.g. 'text'
for text nodes and not simply a string with e.g. element
for element nodes or text
for text nodes.
Sample program:
from saxonc import *
with PySaxonProcessor(license=True) as proc:
print(proc.version)
doc_builder = proc.new_document_builder()
doc1 = doc_builder.parse_xml(xml_text = '<root>a <![CDATA[ && b < c && ]]> d</root>')
print(doc1.children[0].node_kind_str)
print(doc1.children[0].node_kind_str == 'element')
text_node1 = doc1.children[0].children[0]
print(text_node1.node_kind_str)
print(text_node1.node_kind_str == 'text')
outputs
SaxonC-HE 12.0 from Saxonica
'element'
False
'text'
False
Replies (3)
Please register to reply
RE: PyXdmNode.node_kind_str: should it return e.g. a Python string with text for text nodes or with text quoted e.g. 'text'? - Added by Martin Honnen almost 2 years ago
Hmm, 11.4 gives the same confusing result:
SaxonC-HE 11.4 from Saxonica
'element'
False
'text'
False
So I would have to test e.g. doc1.children[0].node_kind_str == "'element'"
? That looks odd, is there a reason for that?
RE: PyXdmNode.node_kind_str: should it return e.g. a Python string with text for text nodes or with text quoted e.g. 'text'? - Added by O'Neil Delpratt almost 2 years ago
This forum post belongs under the SaxonC project, but I cannot move it.
Bug fixed in the node_kind_str method. We were calling the repr() function on the string. i.e.: repr('element')
this is not needed.
RE: PyXdmNode.node_kind_str: should it return e.g. a Python string with text for text nodes or with text quoted e.g. 'text'? - Added by Martin Honnen almost 2 years ago
O'Neil, thanks for finding and fixing this issue although I managed to post it in the wrong forum.
Please register to reply