Skip to content

Commit 5d4244f

Browse files
committed
Add reserved namespace bindings.
This adds xml and xmlns namespace bindings. These are defined at https://www.w3.org/TR/xml-names11/#xmlReserved.
1 parent 1be35e1 commit 5d4244f

File tree

4 files changed

+206
-25
lines changed

4 files changed

+206
-25
lines changed

Changelog.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@
1212

1313
### New Features
1414

15+
- [#541]: Deserialize specially named `$text` enum variant in [externally tagged]
16+
enums from textual content
17+
- [#545]: Resolve well-known namespaces (xml and xmlns) to their approrpriate URIs.
18+
Also, enforce namespace constraints related to these well-known namespaces.
19+
1520
### Bug Fixes
1621

1722
### Misc Changes

src/errors.rs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,16 @@ use std::str::Utf8Error;
99
use std::string::FromUtf8Error;
1010
use std::sync::Arc;
1111

12+
#[derive(Clone, Debug)]
13+
pub struct ReservedNamespacePrefixError {
14+
pub prefix: String,
15+
}
16+
17+
#[derive(Clone, Debug)]
18+
pub struct ReservedNamespaceNameError {
19+
pub name: String,
20+
}
21+
1222
/// The error type used by this crate.
1323
#[derive(Clone, Debug)]
1424
pub enum Error {
@@ -45,6 +55,8 @@ pub enum Error {
4555
InvalidAttr(AttrError),
4656
/// Escape error
4757
EscapeError(EscapeError),
58+
ReservedNamespacePrefixError(ReservedNamespacePrefixError),
59+
ReservedNamespaceNameError(ReservedNamespaceNameError),
4860
/// Specified namespace prefix is unknown, cannot resolve namespace for it
4961
UnknownPrefix(Vec<u8>),
5062
}
@@ -120,7 +132,13 @@ impl fmt::Display for Error {
120132
f.write_str("Unknown namespace prefix '")?;
121133
write_byte_string(f, prefix)?;
122134
f.write_str("'")
123-
}
135+
},
136+
Error::ReservedNamespacePrefixError(e) => write!(
137+
f, "The namespace prefix `{}` is invalid.", e.prefix
138+
),
139+
Error::ReservedNamespaceNameError(e) => write!(
140+
f, "The namespace name `{}` is invalid.", e.name
141+
),
124142
}
125143
}
126144
}

0 commit comments

Comments
 (0)