@@ -47,10 +47,7 @@ use std::str::from_utf8;
47
47
48
48
use crate :: encoding:: Decoder ;
49
49
use crate :: errors:: { Error , IllFormedError , Result } ;
50
- use crate :: escape:: {
51
- escape, minimal_escape, parse_number, partial_escape, resolve_predefined_entity, unescape_with,
52
- EscapeError ,
53
- } ;
50
+ use crate :: escape:: { escape, minimal_escape, parse_number, partial_escape, EscapeError } ;
54
51
use crate :: name:: { LocalName , QName } ;
55
52
#[ cfg( feature = "serialize" ) ]
56
53
use crate :: utils:: CowRef ;
@@ -580,29 +577,12 @@ impl<'a> BytesText<'a> {
580
577
}
581
578
}
582
579
583
- /// Decodes then unescapes the content of the event.
584
- ///
585
- /// This will allocate if the value contains any escape sequences or in
586
- /// non-UTF-8 encoding.
587
- pub fn unescape ( & self ) -> Result < Cow < ' a , str > > {
588
- self . unescape_with ( resolve_predefined_entity)
589
- }
590
-
591
- /// Decodes then unescapes the content of the event with custom entities.
580
+ /// Decodes the content of the event.
592
581
///
593
582
/// This will allocate if the value contains any escape sequences or in
594
583
/// non-UTF-8 encoding.
595
- pub fn unescape_with < ' entity > (
596
- & self ,
597
- resolve_entity : impl FnMut ( & str ) -> Option < & ' entity str > ,
598
- ) -> Result < Cow < ' a , str > > {
599
- let decoded = self . decoder . decode_cow ( & self . content ) ?;
600
-
601
- match unescape_with ( & decoded, resolve_entity) ? {
602
- // Because result is borrowed, no replacements was done and we can use original string
603
- Cow :: Borrowed ( _) => Ok ( decoded) ,
604
- Cow :: Owned ( s) => Ok ( s. into ( ) ) ,
605
- }
584
+ pub fn decode ( & self ) -> Result < Cow < ' a , str > > {
585
+ self . decoder . decode_cow ( & self . content )
606
586
}
607
587
608
588
/// Removes leading XML whitespace bytes from text content.
0 commit comments