Fix incorrect end position in read_to_end
and read_text
#773
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.
Suggestion cannot be applied right now. Please check back later.
When working on #766 I found this bug. When
trim_text_start
is set totrue
, the trailing spaces could not be included in text returned by theread_text
method and not counted in theend
field of the returned span fromread_to_end
family of methods. If you read text content of such XML:then the trailing space would be dropped. This is because we detect end position of the span before we read
</tag>
. When start spaces are trimmed we have 3 events:Start
,Empty
,End
, andbuffer_position()
after reading each of them are:Spaces just skipped and do not update
buffer_position()
which results to the incorrect end of theSpan
. This is happened only when the last meaningful event before the closingEnd
event is not aText
event.