@@ -47,6 +47,22 @@ pub enum Error {
47
47
EscapeError ( EscapeError ) ,
48
48
/// Specified namespace prefix is unknown, cannot resolve namespace for it
49
49
UnknownPrefix ( Vec < u8 > ) ,
50
+ /// Error for when a reserved namespace is set incorrectly.
51
+ ///
52
+ /// This error returned in following cases:
53
+ /// - the XML document attempts to bind `xml` prefix to something other than
54
+ /// `http://www.w3.org/XML/1998/namespace`
55
+ /// - the XML document attempts to bind `xmlns` prefix
56
+ /// - the XML document attempts to bind some prefix (except `xml`) to
57
+ /// `http://www.w3.org/XML/1998/namespace`
58
+ /// - the XML document attempts to bind some prefix to
59
+ /// `http://www.w3.org/2000/xmlns/`
60
+ InvalidPrefixBind {
61
+ /// The prefix that is tried to be bound
62
+ prefix : Vec < u8 > ,
63
+ /// Namespace to which prefix tried to be bound
64
+ namespace : Vec < u8 > ,
65
+ } ,
50
66
}
51
67
52
68
impl From < IoError > for Error {
@@ -121,6 +137,13 @@ impl fmt::Display for Error {
121
137
write_byte_string ( f, prefix) ?;
122
138
f. write_str ( "'" )
123
139
}
140
+ Error :: InvalidPrefixBind { prefix, namespace } => {
141
+ f. write_str ( "The namespace prefix '" ) ?;
142
+ write_byte_string ( f, prefix) ?;
143
+ f. write_str ( "' cannot be bound to '" ) ?;
144
+ write_byte_string ( f, namespace) ?;
145
+ f. write_str ( "'" )
146
+ }
124
147
}
125
148
}
126
149
}
0 commit comments