@@ -306,56 +306,6 @@ impl<R> Reader<R> {
306
306
/// Consumes `Reader` returning the underlying reader
307
307
///
308
308
/// Can be used to compute line and column of a parsing error position
309
- ///
310
- /// # Examples
311
- ///
312
- /// ```
313
- /// # use pretty_assertions::assert_eq;
314
- /// use std::{str, io::Cursor};
315
- /// use quick_xml::Reader;
316
- /// use quick_xml::events::Event;
317
- ///
318
- /// let xml = r#"<tag1 att1 = "test">
319
- /// <tag2><!--Test comment-->Test</tag2>
320
- /// <tag3>Test 2</tag3>
321
- /// </tag1>"#;
322
- /// let mut reader = Reader::from_reader(Cursor::new(xml.as_bytes()));
323
- /// let mut buf = Vec::new();
324
- ///
325
- /// fn into_line_and_column(reader: Reader<Cursor<&[u8]>>) -> (usize, usize) {
326
- /// let end_pos = reader.buffer_position();
327
- /// let mut cursor = reader.into_inner();
328
- /// let s = String::from_utf8(cursor.into_inner()[0..end_pos].to_owned())
329
- /// .expect("can't make a string");
330
- /// let mut line = 1;
331
- /// let mut column = 0;
332
- /// for c in s.chars() {
333
- /// if c == '\n' {
334
- /// line += 1;
335
- /// column = 0;
336
- /// } else {
337
- /// column += 1;
338
- /// }
339
- /// }
340
- /// (line, column)
341
- /// }
342
- ///
343
- /// loop {
344
- /// match reader.read_event_into(&mut buf) {
345
- /// Ok(Event::Start(ref e)) => match e.name().as_ref() {
346
- /// "tag1" | "tag2" => (),
347
- /// tag => {
348
- /// assert_eq!("tag3", tag);
349
- /// assert_eq!((3, 22), into_line_and_column(reader));
350
- /// break;
351
- /// }
352
- /// },
353
- /// Ok(Event::Eof) => unreachable!(),
354
- /// _ => (),
355
- /// }
356
- /// buf.clear();
357
- /// }
358
- /// ```
359
309
pub fn into_inner ( self ) -> R {
360
310
self . reader
361
311
}
0 commit comments