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
Co-authored-by: Daniel Alley <dalley@redhat.com>
  • Loading branch information
Mingun and dralley committed Jul 24, 2022
1 parent f8bae05 commit 92a342c
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! configure_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! configure_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 valid, even though semantically the start tag is the same as the
/// end tag. The reason is that namespaces are 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! configure_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 92a342c

Please sign in to comment.