Only look for attributes for element nodes
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Fixes #97
The main issue was for non-element nodes the ns and nsDef structures can be non-null but also invalid as XML_ATTRIBUTE_NODE cannot have its own attributes or namespace definitions. The code assumed they would be NULL but that is clearly not true.
The fix is to only check for attributes if it is an XML_ELEMENT_NODE and return
character()
otherwise.One other issue this raises is how we want display non-element nodes. Should
format(t1)
be"c='1'"
or is the previous behavior as<c>
sufficient. Most of the time I believe people want to work with element nodes, so probably the previous behavior is fine.