-
Notifications
You must be signed in to change notification settings - Fork 276
Closed
Labels
Description
The example
quick-xml/src/reader/slice_reader.rs
Lines 203 to 217 in 92de42e
| /// 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 <html> elements. | |
| /// let text = reader.read_text(end.name()).unwrap(); | |
| /// assert_eq!(text, Cow::Borrowed(r#" | |
| /// <title>This is a HTML text</title> | |
| /// <p>Usual XML rules does not apply inside it | |
| /// <p>For example, elements not needed to be "closed" | |
| /// "#)); | |
| /// | |
| /// // Now we can enable checks again | |
| /// reader.check_end_names(true); |
for
read_text is incorrect -- doing that will leave reader in incorrect state and you'll get a wrong EndEventMismatch error next time when you'll read surrounding End event:
<some-tag>
<event>
<!-- You decided to .check_end_names(false) after seeing "<event>" -->
...
</event>
<!-- You decided to .check_end_names(true) after seeing "</event>" -->
</some-tag><!-- EndEventMismatch { expected "event", found: "some-tag" } -->Reactions are currently unavailable