Closed eltix closed 2 months ago
would testing for NULL not be easier?
I agree that we have an issue with documentation here, and the documentation for the C-API should be changed to reflect, that a NULL ptr is returned. I just dont want to change the behavior of the library at this point when this part of the code has essentially been there for the past 20 years.
@skeating what do you think?
@fbergmann I am fine with returning NULL too. But then adding a hasPrefix()
or isSetPrefix()
function would be nice :) I've edited the issue description.
agreed, adding such a function can be done.
Issue description
This is the documentation of the
XMLNode_getPrefix()
function. If the XML node has no prefix, e.g. as in this annotation node<COPASI xmlns="http://www.copasi.org/static/sbml">
, the function allegedly returns the empty string.However the implementation contradicts the documentation:
Indeed, the function returns the null pointer instead. Therefore, either the documentation or the implementation should be amended. If the option of keeping the current implementation is preferred, then it would be nice to add a
function (or could be called
isSetPrefix
) which would allow to check whether prefix is set and mention that function in the documentation like it is done forXMLNode_getAttrName
for instance