Skip to content

Commit 4f3b362

Browse files
committed
ns: Add a note about rules for closing tags
1 parent 8b5e73b commit 4f3b362

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! builder_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! builder_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 resolves to the same namespace.
82+
/// The
83+
///
84+
/// ```xml
85+
/// <outer xmlns="namespace" xmlns:p="namespace">
86+
/// </p:outer>
87+
/// ```
88+
///
89+
/// is not a valid XML, although semantically start tag is the same, as the
90+
/// end tag. The reason is that namespaces is 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! builder_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)