Skip to content

Commit 45be217

Browse files
Mingundralley
andcommitted
ns: Add a note about rules for closing tags
Co-authored-by: Daniel Alley <[email protected]>
1 parent f8bae05 commit 45be217

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/reader/mod.rs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ macro_rules! configure_methods {
6565
/// If true the emitted [`End`] event is stripped of trailing whitespace after the markup name.
6666
///
6767
/// Note that if set to `false` and `check_end_names` is true the comparison of markup names is
68-
/// going to fail erronously if a closing tag contains trailing whitespaces.
68+
/// going to fail erroneously if a closing tag contains trailing whitespaces.
6969
///
7070
/// (`true` by default)
7171
///
@@ -77,6 +77,19 @@ macro_rules! configure_methods {
7777

7878
/// Changes whether mismatched closing tag names should be detected.
7979
///
80+
/// Note, that start and end tags [should match literally][spec], they cannot
81+
/// have different prefixes even if both prefixes resolve to the same namespace.
82+
/// The XML
83+
///
84+
/// ```xml
85+
/// <outer xmlns="namespace" xmlns:p="namespace">
86+
/// </p:outer>
87+
/// ```
88+
///
89+
/// is not valid, even though semantically the start tag is the same as the
90+
/// end tag. The reason is that namespaces are an extension of the original
91+
/// XML specification (without namespaces) and it should be backward-compatible.
92+
///
8093
/// When set to `false`, it won't check if a closing tag matches the corresponding opening tag.
8194
/// For example, `<mytag></different_tag>` will be permitted.
8295
///
@@ -91,6 +104,7 @@ macro_rules! configure_methods {
91104
///
92105
/// (`true` by default)
93106
///
107+
/// [spec]: https://www.w3.org/TR/xml11/#dt-etag
94108
/// [`End`]: Event::End
95109
pub fn check_end_names(&mut self, val: bool) -> &mut Self {
96110
self $(.$holder)? .check_end_names = val;

0 commit comments

Comments
 (0)