Usual XML rules does not apply inside it + ///
For example, elements not needed to be "closed" + /// + /// "#); + /// reader.trim_text(true); + /// + /// let start = BytesStart::new("html"); + /// let end = start.to_end().into_owned(); + /// + /// // First, we read a start event... + /// assert_eq!(reader.read_event().unwrap(), Event::Start(start)); + /// // ...and disable checking of end names because we expect HTML further... + /// reader.check_end_names(false); + /// + /// // ...then, we could read text content until close tag. + /// // This call will correctly handle nested elements. + /// let text = reader.read_text(end.name()).unwrap(); + /// assert_eq!(text, Cow::Borrowed(r#" + ///
Usual XML rules does not apply inside it + ///
For example, elements not needed to be "closed"
+ /// "#));
+ ///
+ /// // Now we can enable checks again
+ /// reader.check_end_names(true);
+ ///
+ /// // At the end we should get an Eof event, because we ate the whole XML
+ /// assert_eq!(reader.read_event().unwrap(), Event::Eof);
+ /// ```
+ ///
+ /// [`Start`]: Event::Start
+ /// [`decoder()`]: Reader::decoder()
+ #[inline]
+ pub fn read_text(&mut self, end: QName) -> Result Usual XML rules does not apply inside it
+ /// For example, elements not needed to be "closed"
+ ///
+ /// ");
+ /// reader.trim_text(true);
+ ///
+ /// let start = BytesStart::new("html");
+ /// let end = start.to_end().into_owned();
+ ///
+ /// // First, we read a start event...
+ /// assert_eq!(reader.read_event().unwrap(), Event::Start(start));
+ /// // ...and disable checking of end names because we expect HTML further...
+ /// reader.check_end_names(false);
+ ///
+ /// // ...then, we could read text content until close tag.
+ /// // This call will correctly handle nested elements.
+ /// let text = reader.read_text(end.name()).unwrap();
+ /// assert_eq!(text, Cow::Borrowed(r#"
+ /// Usual XML rules does not apply inside it
+ /// For example, elements not needed to be "closed"
+ /// "#));
+ ///
+ /// // Now we can enable checks again
+ /// reader.check_end_names(true);
+ ///
+ /// // At the end we should get an Eof event, because we ate the whole XML
+ /// assert_eq!(reader.read_event().unwrap(), Event::Eof);
+ /// ```
+ ///
+ /// [`Start`]: Event::Start
+ /// [`decoder()`]: Self::decoder()
+ pub fn read_text(&mut self, end: QName) -> Result