## xmlparser
[](https://travis-ci.org/RazrFalcon/xmlparser)
[](https://crates.io/crates/xmlparser)
[](https://docs.rs/xmlparser)
[](https://www.rust-lang.org)
*xmlparser* is a low-level, pull-based, zero-allocation
[XML 1.0](https://www.w3.org/TR/xml/) parser.
### Example
```rust
for token in xmlparser::Tokenizer::from("<tagname name='value'/>") {
println!("{:?}", token);
}
```
### Why a new library
This library is basically a low-level XML tokenizer that preserves a position of the tokens
and does not intend to be used directly.
If you are looking for a more high-level solution - checkout
[roxmltree](https://github.com/RazrFalcon/roxmltree).
### Benefits
- All tokens contain `StrSpan` objects which contain position of the substring
in the original document.
- Good error processing. All error types contain position (line:column) where it occurred.
- No heap allocations.
- No dependencies.
- Tiny. ~1400 LOC and ~30KiB in the release build according to the `cargo-bloat`.
- Supports `no_std` builds. To use without the standard library, disable the default features.
### Limitations
- Currently, only ENTITY objects are parsed from the DOCTYPE. Other ignored.
- No tree structure validation. So an XML like `<root><child></root></child>`
or a string without root element
will be parsed without errors. You should check for this manually.
On the other hand `<a/><a/>` will lead to an error.
- Duplicated attributes is not an error. So an XML like `<item a="v1" a="v2"/>`
will be parsed without errors. You should check for this manually.
- UTF-8 only.
### Safety
- The library must not panic. Any panic considered as a critical bug
and should be reported.
- The library forbids the unsafe code.
### License
Licensed under either of
- Apache License, Version 2.0
([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license
([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
at your option.
### Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted
for inclusion in the work by you, as defined in the Apache-2.0 license, shall be
dual licensed as above, without any additional terms or conditions.