|
2 | 2 | * License, v. 2.0. If a copy of the MPL was not distributed with this
|
3 | 3 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
4 | 4 |
|
5 |
| -// FIXME: This is copied from Servo. The two modules should be unified. |
| 5 | +// FIXME: Unify with Servo's namespace.rs. |
6 | 6 |
|
7 | 7 | #[deriving(Eq, Clone)]
|
8 | 8 | pub enum Namespace {
|
9 |
| - Null, |
10 | 9 | HTML,
|
11 |
| - XML, |
12 |
| - XMLNS, |
13 |
| - XLink, |
14 |
| - SVG, |
15 |
| - MathML, |
16 |
| - Other(StrBuf) |
17 |
| -} |
18 |
| - |
19 |
| -impl Namespace { |
20 |
| - /// Empty string for "no namespace" |
21 |
| - pub fn from_str(url: &str) -> Namespace { |
22 |
| - match url { |
23 |
| - "http://www.w3.org/1999/xhtml" => HTML, |
24 |
| - "http://www.w3.org/XML/1998/namespace" => XML, |
25 |
| - "http://www.w3.org/2000/xmlns/" => XMLNS, |
26 |
| - "http://www.w3.org/1999/xlink" => XLink, |
27 |
| - "http://www.w3.org/2000/svg" => SVG, |
28 |
| - "http://www.w3.org/1998/Math/MathML" => MathML, |
29 |
| - "" => Null, |
30 |
| - ns => Other(ns.to_strbuf()) |
31 |
| - } |
32 |
| - } |
33 |
| - pub fn to_str<'a>(&'a self) -> &'a str { |
34 |
| - match *self { |
35 |
| - Null => "", |
36 |
| - HTML => "http://www.w3.org/1999/xhtml", |
37 |
| - XML => "http://www.w3.org/XML/1998/namespace", |
38 |
| - XMLNS => "http://www.w3.org/2000/xmlns/", |
39 |
| - XLink => "http://www.w3.org/1999/xlink", |
40 |
| - SVG => "http://www.w3.org/2000/svg", |
41 |
| - MathML => "http://www.w3.org/1998/Math/MathML", |
42 |
| - Other(ref x) => x.as_slice() |
43 |
| - } |
44 |
| - } |
| 10 | + // FIXME: others |
45 | 11 | }
|
0 commit comments