tafia / quick-xml

Rust high performance xml reader and writer
MIT License
1.22k stars 237 forks source link

Allow attributes in the `Event::End` and fix `.error_position()` #780

Closed Mingun closed 4 months ago

Mingun commented 4 months ago

This PR allows us to have attributes in the Event::End (but they are not accessible via BytesEnd directly). As explained in https://github.com/tafia/quick-xml/issues/776#issuecomment-2208078867 we anyway can produce an event which .name() does not valid, so it is better ar least keep it useful for some scenarios. When validation API would be added (I'm working on it) we can validate all events and report an error.

Closes #776

When changing parser I noticed, that in one arm we do not set last_error_offset. I checked if we really cover that lines -- yes, but we actually does not check anything. last_error_offset was checked for 0, but this is its default value, so was unclear is that code running or not. I improved check and fix the bug that was found due to that.

codecov-commenter commented 4 months ago

:warning: Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 92.47312% with 7 lines in your changes missing coverage. Please review.

Project coverage is 60.01%. Comparing base (7558577) to head (6a48a28). Report is 79 commits behind head on master.

Files Patch % Lines
src/reader/mod.rs 95.50% 4 Missing :warning:
examples/custom_entities.rs 0.00% 1 Missing :warning:
examples/read_buffered.rs 0.00% 1 Missing :warning:
examples/read_texts.rs 0.00% 1 Missing :warning:

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #780 +/- ## ========================================== - Coverage 61.81% 60.01% -1.81% ========================================== Files 41 41 Lines 16798 16048 -750 ========================================== - Hits 10384 9631 -753 - Misses 6414 6417 +3 ``` | [Flag](https://app.codecov.io/gh/tafia/quick-xml/pull/780/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/tafia/quick-xml/pull/780/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None) | `60.01% <92.47%> (-1.81%)` | :arrow_down: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

Mingun commented 4 months ago

Task CIFuzz was failed by unknown reasons -- I asked https://github.com/google/oss-fuzz/issues/12168 but no response yet... It not related to this changes, so merge