@@ -231,94 +231,6 @@ impl<'a> BytesStart<'a> {
231231 self . name ( ) . into ( )
232232 }
233233
234- /// Gets the unescaped tag name.
235- ///
236- /// XML escape sequences like "`<`" will be replaced by their unescaped characters like
237- /// "`<`".
238- ///
239- /// See also [`unescaped_with_custom_entities()`](#method.unescaped_with_custom_entities)
240- #[ inline]
241- pub fn unescaped ( & self ) -> Result < Cow < [ u8 ] > > {
242- self . make_unescaped ( None )
243- }
244-
245- /// Gets the unescaped tag name, using custom entities.
246- ///
247- /// XML escape sequences like "`<`" will be replaced by their unescaped characters like
248- /// "`<`".
249- /// Additional entities can be provided in `custom_entities`.
250- ///
251- /// # Pre-condition
252- ///
253- /// The keys and values of `custom_entities`, if any, must be valid UTF-8.
254- ///
255- /// See also [`unescaped()`](#method.unescaped)
256- #[ inline]
257- pub fn unescaped_with_custom_entities < ' s > (
258- & ' s self ,
259- custom_entities : & HashMap < Vec < u8 > , Vec < u8 > > ,
260- ) -> Result < Cow < ' s , [ u8 ] > > {
261- self . make_unescaped ( Some ( custom_entities) )
262- }
263-
264- #[ inline]
265- fn make_unescaped < ' s > (
266- & ' s self ,
267- custom_entities : Option < & HashMap < Vec < u8 > , Vec < u8 > > > ,
268- ) -> Result < Cow < ' s , [ u8 ] > > {
269- do_unescape ( & * self . buf , custom_entities) . map_err ( Error :: EscapeError )
270- }
271-
272- /// Returns the unescaped and decoded string value.
273- ///
274- /// This allocates a `String` in all cases. For performance reasons it might be a better idea to
275- /// instead use one of:
276- ///
277- /// * [`unescaped()`], as it doesn't allocate when no escape sequences are used.
278- /// * [`Reader::decode()`], as it only allocates when the decoding can't be performed otherwise.
279- ///
280- /// [`unescaped()`]: #method.unescaped
281- /// [`Reader::decode()`]: ../reader/struct.Reader.html#method.decode
282- #[ inline]
283- pub fn unescape_and_decode < B : BufRead > ( & self , reader : & Reader < B > ) -> Result < String > {
284- self . do_unescape_and_decode_with_custom_entities ( reader, None )
285- }
286-
287- /// Returns the unescaped and decoded string value with custom entities.
288- ///
289- /// This allocates a `String` in all cases. For performance reasons it might be a better idea to
290- /// instead use one of:
291- ///
292- /// * [`unescaped_with_custom_entities()`], as it doesn't allocate when no escape sequences are used.
293- /// * [`Reader::decode()`], as it only allocates when the decoding can't be performed otherwise.
294- ///
295- /// [`unescaped_with_custom_entities()`]: #method.unescaped_with_custom_entities
296- /// [`Reader::decode()`]: ../reader/struct.Reader.html#method.decode
297- ///
298- /// # Pre-condition
299- ///
300- /// The keys and values of `custom_entities`, if any, must be valid UTF-8.
301- #[ inline]
302- pub fn unescape_and_decode_with_custom_entities < B : BufRead > (
303- & self ,
304- reader : & Reader < B > ,
305- custom_entities : & HashMap < Vec < u8 > , Vec < u8 > > ,
306- ) -> Result < String > {
307- self . do_unescape_and_decode_with_custom_entities ( reader, Some ( custom_entities) )
308- }
309-
310- #[ inline]
311- fn do_unescape_and_decode_with_custom_entities < B : BufRead > (
312- & self ,
313- reader : & Reader < B > ,
314- custom_entities : Option < & HashMap < Vec < u8 > , Vec < u8 > > > ,
315- ) -> Result < String > {
316- let decoded = reader. decoder ( ) . decode ( & * self ) ?;
317-
318- let unescaped = do_unescape ( decoded. as_bytes ( ) , custom_entities) ?;
319- Ok ( String :: from_utf8 ( unescaped. into_owned ( ) ) ?)
320- }
321-
322234 /// Edit the name of the BytesStart in-place
323235 ///
324236 /// # Warning
0 commit comments