Skip to content

Commit

Permalink
ns: Add a note about rules for closing tags
Browse files Browse the repository at this point in the history
  • Loading branch information
Mingun committed Jul 23, 2022
1 parent 8b5e73b commit 4f3b362
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/reader/mod.rs
Expand Up @@ -65,7 +65,7 @@ macro_rules! builder_methods {
/// If true the emitted [`End`] event is stripped of trailing whitespace after the markup name.
///
/// Note that if set to `false` and `check_end_names` is true the comparison of markup names is
/// going to fail erronously if a closing tag contains trailing whitespaces.
/// going to fail erroneously if a closing tag contains trailing whitespaces.
///
/// (`true` by default)
///
Expand All @@ -77,6 +77,19 @@ macro_rules! builder_methods {

/// Changes whether mismatched closing tag names should be detected.
///
/// Note, that start and end tags [should match literally][spec], they cannot
/// have different prefixes even if both prefixes resolves to the same namespace.
/// The
///
/// ```xml
/// <outer xmlns="namespace" xmlns:p="namespace">
/// </p:outer>
/// ```
///
/// is not a valid XML, although semantically start tag is the same, as the
/// end tag. The reason is that namespaces is an extension of the original
/// XML specification (without namespaces) and it should be backward-compatible.
///
/// When set to `false`, it won't check if a closing tag matches the corresponding opening tag.
/// For example, `<mytag></different_tag>` will be permitted.
///
Expand All @@ -91,6 +104,7 @@ macro_rules! builder_methods {
///
/// (`true` by default)
///
/// [spec]: https://www.w3.org/TR/xml11/#dt-etag
/// [`End`]: Event::End
pub fn check_end_names(&mut self, val: bool) -> &mut Self {
self $(.$holder)? .check_end_names = val;
Expand Down

0 comments on commit 4f3b362

Please sign in to comment.