Proper attribute value normalization#943
Conversation
…ttribute-Value Normalization" section of XML 1.0 / 1.1. spec Note: the normalization algorithm itself the same, but EOL normalization rules differs - 1.0: https://www.w3.org/TR/xml/#AVNormalize - 1.1: https://www.w3.org/TR/xml11/#AVNormalize
| /// Attribute normalization includes expanding of general entities (`&entity;`) | ||
| /// which replacement text also could contain entities, which is also must be expanded. | ||
| /// If more than 128 entities would be expanded, this error is returned. | ||
| TooManyNestedEntities, |
There was a problem hiding this comment.
Thoughts on automatic loop detection? (note from previous PR)
Also I've noticed that some implementations detect an entity loop immediately instead of processing until the recursion limit is reached. Should that be two separate errors in your opinion, or one error?
Obviously it would not need to be added in this PR. Just, as a general concept, should an issue be filed for it
|
Some build / test failures, obviously |
|
|
||
| match attr.decoded_and_normalized_value(V1_0, Decoder::utf8()) { | ||
| // TODO: is this divergence between range behavior of UnterminatedEntity | ||
| // and UnrecognizedEntity appropriate? existing unescape code behaves the same. (see: start index) |
There was a problem hiding this comment.
This is my comment obviously, just checking if you saw it and whether that can be dismissed or if it is something to resolve later.
There was a problem hiding this comment.
Definitely, I also do not like the current situation and I agree with you here. Will need to think about it later, probably when dealing with #625
- `escaped` to `is_attr` because it is set to true only for attributes - `from_part()` to `from_attr()` for the same reason
… err
failures:
serde-issues:
issue674
serde-de:
xml_version::v1_0_explicit
xml_version::v1_0_implicit
xml_version::v1_1
Fixed all tests:
serde-de:
xml_version::v1_0_explicit
xml_version::v1_0_implicit
xml_version::v1_1
serde-issues:
issue674
a0ec487 to
a6fbb5c
Compare
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #943 +/- ##
==========================================
+ Coverage 55.00% 55.96% +0.96%
==========================================
Files 44 44
Lines 16816 17402 +586
==========================================
+ Hits 9249 9739 +490
- Misses 7567 7663 +96
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:
|
|
@dralley, I fixed build failures (as usual, forgot about benchmarks) and other places you pointed. |
Rebased and finished #379.
Added
Attribute::normalized_value()Attribute::normalized_value_with()Attribute::decoded_and_normalized_value()Attribute::decoded_and_normalized_value_with()which ought to be used in place of deprecated
Attribute::unescape_value()Attribute::unescape_value_with()Attribute::decode_and_unescape_value()Attribute::decode_and_unescape_value_with()Deserializer now also uses normalized value of attributes, which fixes #674.
Closes #371, closes #843