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