xtoken

Crates.ioxtoken
lib.rsxtoken
version0.1.1
sourcesrc
created_at2023-07-13 21:16:01.913073
updated_at2023-07-13 21:28:32.667213
descriptionIterator based no_std XML Tokenizer using memchr
homepage
repositoryhttps://github.com/Xiphoseer/xtoken
max_upload_size
id915644
size12,033
Daniel Seiler (Xiphoseer)

documentation

README

xtoken

Iterator based no_std XML Tokenizer using memchr.

Design Goals

  • Operates on byte slices
  • Minimal Validation
  • Support for inline DTD declaration
  • Partition whole input into non-empty spans

Example

use xtoken::{Token, Tokenizer};

let tokens = Tokenizer::new(b"<x>Hello World!</x>").collect::<Vec<_>>();
assert_eq!(&tokens, &[
    Token::Element(b"<x>"),
    Token::Span(b"Hello World!"),
    Token::ElementEnd(b"</x>"),
]);

let tokens = Tokenizer::new(b"<!DOCTYPE xml>").collect::<Vec<_>>();
assert_eq!(&tokens, &[
    Token::Decl(b"<!DOCTYPE xml>")
]);
Commit count: 2

cargo fmt