einvoice-xml
A streaming (pull) parser of XML 1.0 documents with namespaces, in pure Rust (no unsafe,
no C): it builds no tree, so that well-formedness checking and validation can run in one
pass over a document in memory that does not grow with the document. Names, and text and
attribute values that need no reference replacement or normalisation, are slices of the
input; the reader keeps only the open elements, the namespace declarations in scope and
the attributes of the current start tag.
use ;
Supported: UTF-8 text (a byte order mark is skipped; einvoice_xml::decode decodes a document
given as bytes, in UTF-8, UTF-16, US-ASCII, ISO-8859-1, ISO-8859-15 or windows-1252, as libxml2 and Saxon-HE's parser both read it,
refusing any other encoding), the XML declaration, elements,
attributes, namespaces, comments, processing instructions, CDATA sections, character
references and the five predefined entities, line-end and attribute-value normalisation.
Document type declarations are refused, and so is any other entity.
The reader accepts the documents that the roxmltree crate (0.21, document type
declarations refused) accepts and that are namespace-well-formed, and reports
roxmltree's error (message and position) on the documents it refuses, except on the few
constructs that roxmltree accepts against XML 1.0 or Namespaces in XML, which the crate
documentation lists. The test suite checks this on every XML file of the repository, on
generated and damaged documents, and checks the documented differences against Saxon-HE.
Limits bounds
nodes, depth, attributes and namespace declarations; time is linear in the input.
This crate is part of einvoice-validator, which validates EN 16931 and Peppol BIS Billing 3.0 e-invoices against the official validation artefacts in pure Rust. Documentation: https://docs.rs/einvoice-xml.
Licence
MIT (LICENSES/MIT.txt).