1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
// Copyright 2018 Evgeniy Reizner
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
/*!
**DEPRECATED**. Use [`svgtypes`](https://github.com/RazrFalcon/svgtypes) instead.
*svgparser* is a pull-based parser for [SVG 1.1 Full](https://www.w3.org/TR/SVG/)
data format without heap allocations.
It's not an XML parser since it does not only split the content into the XML nodes,
but also supports [SVG types](https://www.w3.org/TR/SVG/types.html#BasicDataTypes) parsing.
### Supported SVG types
- [\<color\>](https://www.w3.org/TR/SVG/types.html#DataTypeColor)
- [\<paint\>](https://www.w3.org/TR/SVG/painting.html#SpecifyingPaint)
- [\<path\>](https://www.w3.org/TR/SVG/paths.html#PathData)
- [\<number\>](https://www.w3.org/TR/SVG/types.html#DataTypeNumber) and \<list-of-numbers\>
- [\<length\>](https://www.w3.org/TR/SVG/types.html#DataTypeLength) and \<list-of-lengths\>
- [\<coordinate\>](https://www.w3.org/TR/SVG/types.html#DataTypeCoordinate)
- [\<IRI\>](https://www.w3.org/TR/SVG/types.html#DataTypeIRI)
- [\<FuncIRI\>](https://www.w3.org/TR/SVG/types.html#DataTypeFuncIRI)
- [\<transform-list\>](https://www.w3.org/TR/SVG/types.html#DataTypeTransformList)
- [\<style\>](https://www.w3.org/TR/SVG/styling.html#StyleAttribute)
- [\<viewBox\>](https://www.w3.org/TR/SVG11/coords.html#ViewBoxAttribute)
- [\<list-of-points\>](https://www.w3.org/TR/SVG11/shapes.html#PointsBNF)
### Benefits
- Most of the common data parsed into internal representation, and not just as string
(unlike typical XML parser). Tag names, attribute names, attributes value, etc.
- Complete support of paths, so data like `M10-20A5.5.3-4 110-.1` will be parsed correctly.
- [Predefined SVG values](https://www.w3.org/TR/SVG/propidx.html) for presentation attributes,
like `auto`, `normal`, `none`, `inherit`, etc. are parsed as `enum`, not as `String`.
- Every type can be parsed separately, so you can parse just paths or transform
or any other SVG value.
- Good error processing. All error types contain position (line:column) where it occurred.
- No heap allocations.
- Pretty fast.
### Limitations
- All keywords must be lowercase.
Case-insensitive parsing is supported only for colors (requires allocation for named colors).
Still, it's extremely rare.
- The `<color>` followed by the `<icccolor>` is not supported. As the `<icccolor>` itself.
- Only ENTITY objects are parsed from the DOCTYPE. Other ignored.
- CSS styles does not processed. You should use an external CSS parser.
- Comments inside attributes value supported only for the `style` attribute.
- [System colors](https://www.w3.org/TR/css3-color/#css2-system), like `fill="AppWorkspace"`, are not supported.
- There is no separate `opacity-value` type. It will be parsed as `<number>`,
but will be bound to 0..1 range.
- Implicit path commands are not supported. All commands are parsed as explicit.
- Implicit MoveTo commands will be automatically converted into explicit LineTo.
### Safety
- The library should not panic. Any panic considered as a critical bug
and should be reported.
- The library forbids unsafe code.
*/
pub extern crate xmlparser;
extern crate phf;
extern crate log;
extern crate failure;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use StreamError;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;