Improve XmlVersion enumeration: explicit and implicit 1.0 variants#955
Open
Mingun wants to merge 4 commits intotafia:masterfrom
Open
Improve XmlVersion enumeration: explicit and implicit 1.0 variants#955Mingun wants to merge 4 commits intotafia:masterfrom
Mingun wants to merge 4 commits intotafia:masterfrom
Conversation
Tests in src/events/attributes.rs copied from Implicit1_0 variants
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #955 +/- ##
==========================================
+ Coverage 55.08% 56.47% +1.38%
==========================================
Files 44 44
Lines 16911 17648 +737
==========================================
+ Hits 9316 9966 +650
- Misses 7595 7682 +87
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR changes XmlVersion from
to
The motivation behind this change is simplification with processing versions. XML specification explicitly allows at most one XML declaration (the
<?xml version=...?>part). At the same time theversioninformation in the declaration is mandatory. This leads us to a simple cycle that allows, using one variable, to track the uniqueness of the declaration and obtain values according to the versionWithout thus changes you may use
Option<XmlVersion>, but then you will forced to usee.xml_content(version.unwrap_or(XmlVersion::V1_0)), which will add check forNonefor every usage ofversionin the loop. Usually XML documents a well-formed, so this is just wasting of CPU cycles.XmlVersionis not a part of any release yet, so it can be changed freely.