@@ -239,14 +239,14 @@ where
239
239
// We shouldn't have both `$value` and `$text` fields in the same
240
240
// struct, so if we have `$value` field, the we should deserialize
241
241
// text content to `$value`
242
- DeEvent :: Text ( _) | DeEvent :: CData ( _ ) if self . has_value_field => {
242
+ DeEvent :: Text ( _) if self . has_value_field => {
243
243
self . source = ValueSource :: Content ;
244
244
// Deserialize `key` from special attribute name which means
245
245
// that value should be taken from the text content of the
246
246
// XML node
247
247
seed. deserialize ( VALUE_KEY . into_deserializer ( ) ) . map ( Some )
248
248
}
249
- DeEvent :: Text ( _) | DeEvent :: CData ( _ ) => {
249
+ DeEvent :: Text ( _) => {
250
250
self . source = ValueSource :: Text ;
251
251
// Deserialize `key` from special attribute name which means
252
252
// that value should be taken from the text content of the
@@ -307,19 +307,11 @@ where
307
307
// </any-tag>
308
308
// The whole map represented by an `<any-tag>` element, the map key
309
309
// is implicit and equals to the `TEXT_KEY` constant, and the value
310
- // is a `Text` or a `CData` event (the value deserializer will see one
311
- // of that events)
310
+ // is a `Text` event (the value deserializer will see that event)
312
311
// This case are checked by "xml_schema_lists::element" tests in tests/serde-de.rs
313
312
ValueSource :: Text => match self . de . next ( ) ? {
314
- DeEvent :: Text ( e) => seed. deserialize ( SimpleTypeDeserializer :: from_text_content (
315
- // Comment to prevent auto-formatting
316
- e. decode ( true ) ?,
317
- ) ) ,
318
- DeEvent :: CData ( e) => seed. deserialize ( SimpleTypeDeserializer :: from_text_content (
319
- // Comment to prevent auto-formatting
320
- e. decode ( ) ?,
321
- ) ) ,
322
- // SAFETY: We set `Text` only when we seen `Text` or `CData`
313
+ DeEvent :: Text ( e) => seed. deserialize ( SimpleTypeDeserializer :: from_text_content ( e) ) ,
314
+ // SAFETY: We set `Text` only when we seen `Text`
323
315
_ => unreachable ! ( ) ,
324
316
} ,
325
317
// This arm processes the following XML shape:
@@ -431,7 +423,7 @@ where
431
423
///
432
424
/// The whole map represented by an `<any-tag>` element, the map key is
433
425
/// implicit and equals to the [`VALUE_KEY`] constant, and the value is
434
- /// a [`Text`], a [`CData`], or a [`Start`] event (the value deserializer
426
+ /// a [`Text`], or a [`Start`] event (the value deserializer
435
427
/// will see one of those events). In the first two cases the value of this
436
428
/// field do not matter (because we already see the textual event and there
437
429
/// no reasons to look "inside" something), but in the last case the primitives
@@ -452,7 +444,6 @@ where
452
444
/// as accepting "text content" which the currently `$text` means.
453
445
///
454
446
/// [`Text`]: DeEvent::Text
455
- /// [`CData`]: DeEvent::CData
456
447
/// [`Start`]: DeEvent::Start
457
448
allow_start : bool ,
458
449
}
@@ -464,11 +455,11 @@ where
464
455
/// Returns a next string as concatenated content of consequent [`Text`] and
465
456
/// [`CData`] events, used inside [`deserialize_primitives!()`].
466
457
///
467
- /// [`Text`]: DeEvent ::Text
468
- /// [`CData`]: DeEvent ::CData
458
+ /// [`Text`]: crate::events::Event ::Text
459
+ /// [`CData`]: crate::events::Event ::CData
469
460
#[ inline]
470
- fn read_string ( & mut self , unescape : bool ) -> Result < Cow < ' de , str > , DeError > {
471
- self . map . de . read_string_impl ( unescape , self . allow_start )
461
+ fn read_string ( & mut self ) -> Result < Cow < ' de , str > , DeError > {
462
+ self . map . de . read_string_impl ( self . allow_start )
472
463
}
473
464
}
474
465
@@ -631,8 +622,8 @@ impl<'de> TagFilter<'de> {
631
622
/// Depending on [`Self::filter`], only some of that possible constructs would be
632
623
/// an element.
633
624
///
634
- /// [`Text`]: DeEvent ::Text
635
- /// [`CData`]: DeEvent ::CData
625
+ /// [`Text`]: crate::events::Event ::Text
626
+ /// [`CData`]: crate::events::Event ::CData
636
627
struct MapValueSeqAccess < ' de , ' a , ' m , R >
637
628
where
638
629
R : XmlRead < ' de > ,
@@ -697,7 +688,7 @@ where
697
688
// opened tag `self.map.start`
698
689
DeEvent :: Eof => Err ( DeError :: UnexpectedEof ) ,
699
690
700
- // Start(tag), Text, CData
691
+ // Start(tag), Text
701
692
_ => seed
702
693
. deserialize ( SeqItemDeserializer { map : self . map } )
703
694
. map ( Some ) ,
@@ -725,11 +716,11 @@ where
725
716
/// Returns a next string as concatenated content of consequent [`Text`] and
726
717
/// [`CData`] events, used inside [`deserialize_primitives!()`].
727
718
///
728
- /// [`Text`]: DeEvent ::Text
729
- /// [`CData`]: DeEvent ::CData
719
+ /// [`Text`]: crate::events::Event ::Text
720
+ /// [`CData`]: crate::events::Event ::CData
730
721
#[ inline]
731
- fn read_string ( & mut self , unescape : bool ) -> Result < Cow < ' de , str > , DeError > {
732
- self . map . de . read_string_impl ( unescape , true )
722
+ fn read_string ( & mut self ) -> Result < Cow < ' de , str > , DeError > {
723
+ self . map . de . read_string_impl ( true )
733
724
}
734
725
}
735
726
@@ -781,31 +772,17 @@ where
781
772
V : Visitor < ' de > ,
782
773
{
783
774
match self . map . de . next ( ) ? {
784
- DeEvent :: Text ( e) => SimpleTypeDeserializer :: from_text_content (
785
- // Comment to prevent auto-formatting
786
- e. decode ( true ) ?,
787
- )
788
- . deserialize_seq ( visitor) ,
789
- DeEvent :: CData ( e) => SimpleTypeDeserializer :: from_text_content (
790
- // Comment to prevent auto-formatting
791
- e. decode ( ) ?,
792
- )
793
- . deserialize_seq ( visitor) ,
775
+ DeEvent :: Text ( e) => {
776
+ SimpleTypeDeserializer :: from_text_content ( e) . deserialize_seq ( visitor)
777
+ }
794
778
// This is a sequence element. We cannot treat it as another flatten
795
779
// sequence if type will require `deserialize_seq` We instead forward
796
780
// it to `xs:simpleType` implementation
797
781
DeEvent :: Start ( e) => {
798
782
let value = match self . map . de . next ( ) ? {
799
- DeEvent :: Text ( e) => SimpleTypeDeserializer :: from_text_content (
800
- // Comment to prevent auto-formatting
801
- e. decode ( true ) ?,
802
- )
803
- . deserialize_seq ( visitor) ,
804
- DeEvent :: CData ( e) => SimpleTypeDeserializer :: from_text_content (
805
- // Comment to prevent auto-formatting
806
- e. decode ( ) ?,
807
- )
808
- . deserialize_seq ( visitor) ,
783
+ DeEvent :: Text ( e) => {
784
+ SimpleTypeDeserializer :: from_text_content ( e) . deserialize_seq ( visitor)
785
+ }
809
786
e => Err ( DeError :: Unsupported (
810
787
format ! ( "unsupported event {:?}" , e) . into ( ) ,
811
788
) ) ,
@@ -814,8 +791,8 @@ where
814
791
self . map . de . read_to_end ( e. name ( ) ) ?;
815
792
value
816
793
}
817
- // SAFETY: we use that deserializer only when Start(element), Text,
818
- // or CData event Start(tag), Text, CData was peeked already
794
+ // SAFETY: we use that deserializer only when Start(element) or Text
795
+ // event was peeked already
819
796
_ => unreachable ! ( ) ,
820
797
}
821
798
}
0 commit comments