-
Notifications
You must be signed in to change notification settings - Fork 236
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix incorrect missing of trimming all-space text events when trim_text_start = false
and trim_text_end = true
#755
Conversation
Codecov ReportAttention: Patch coverage is
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## master #755 +/- ##
==========================================
+ Coverage 61.24% 61.81% +0.57%
==========================================
Files 39 41 +2
Lines 16277 16798 +521
==========================================
+ Hits 9969 10384 +415
- Misses 6308 6414 +106
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
(Review in whitespace changes ignored mode)
…ion in next iteration of loop
…byte` parameter to b'<'
(Review in whitespace changes ignored mode)
Previously we stay in ClosedTag state and after reaching EOF in it in next read_event make two XmlSource calls that
@@ -211,7 +211,7 @@ macro_rules! read_event_impl { | |||
) => {{ | |||
let event = loop { | |||
break match $self.state.state { | |||
ParseState::Init => { // Go to OpenedTag state |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The commit message says "renamed for brevity". I'm not sure that brevity is the correct word since these names are longer than the original ones.
I'm fine with the new names, though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, yes, I confused it with "clarity"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I fixed commit message in force push
@@ -14,11 +14,15 @@ | |||
|
|||
### Bug Fixes | |||
|
|||
- [#755]: Fix incorrect missing of trimming all-space text events when | |||
`trim_text_start = false` and `trim_text_end = true`. | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Re: " events should not be trimmed at boundary of text / CDATA, or text / PI, or text / comment in some cases", is there an issue filed for that with some examples of such boundary cases?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, such issue does not exist. I made investigation in #520 for serde deserializer and implement reading text properly. I cross-checked that using Java XmlBeans library.
- OpenedTag -> InsideMarkup - ClosedTag -> InsideText - Empty -> InsideEmpty - Exit -> Done
…t_start = false and trim_text_end = true This is still not complete fix, because we will generate empty Event::Text although we should not do that, but it is hard to prevent generation of such event. Moreover it would be better to remove ability of automatic trimming completely, because it is anyway does not work correctly -- events should not be trimmed at boundary of text / CDATA, or text / PI, or text / comment in some cases
I was refactoring for another task and accidentally found 2 errors:
in
ReaderState::emit_text
there was a misprint: if string does not contain non-space symbols it remains unchanged instead of making emptyThis error was actually masked by the previous. After fixing it
ReaderState::emit_text
could make empty slice which then translated toEvent::Eof
. However, this function is called in two cases:<
which switches parser fromInsideText
toInsideMarkup
stateInsideText
stateEvent::Eof
should be generated only in the latter case.The changes also shows small performance improvements: