| 1 | //! High performance XML reader/writer.
|
| 2 | //!
|
| 3 | //! # Description
|
| 4 | //!
|
| 5 | //! quick-xml contains two modes of operation:
|
| 6 | //!
|
| 7 | //! A streaming API based on the [StAX] model. This is suited for larger XML documents which
|
| 8 | //! cannot completely read into memory at once.
|
| 9 | //!
|
| 10 | //! The user has to explicitly _ask_ for the next XML event, similar to a database cursor.
|
| 11 | //! This is achieved by the following two structs:
|
| 12 | //!
|
| 13 | //! - [`Reader`]: A low level XML pull-reader where buffer allocation/clearing is left to user.
|
| 14 | //! - [`Writer`]: A XML writer. Can be nested with readers if you want to transform XMLs.
|
| 15 | //!
|
| 16 | //! Especially for nested XML elements, the user must keep track _where_ (how deep)
|
| 17 | //! in the XML document the current event is located.
|
| 18 | //!
|
| 19 | //! quick-xml contains optional support of asynchronous reading and writing using [tokio].
|
| 20 | //! To get it enable the `async-tokio` feature.
|
| 21 | //!
|
| 22 | //! Furthermore, quick-xml also contains optional [Serde] support to directly
|
| 23 | //! serialize and deserialize from structs, without having to deal with the XML events.
|
| 24 | //! To get it enable the `serialize` feature. Read more about mapping Rust types
|
| 25 | //! to XML in the documentation of [`de`] module. Also check [`serde_helpers`]
|
| 26 | //! module.
|
| 27 | //!
|
| 28 | //! # Examples
|
| 29 | //!
|
| 30 | //! - For a reading example see [`Reader`]
|
| 31 | //! - For a writing example see [`Writer`]
|
| 32 | //!
|
| 33 | //! # Features
|
| 34 | //!
|
| 35 | //! `quick-xml` supports the following features:
|
| 36 | //!
|
| 37 | //! [StAX]: https://en.wikipedia.org/wiki/StAX
|
| 38 | //! [tokio]: https://tokio.rs/
|
| 39 | //! [Serde]: https://serde.rs/
|
| 40 | //! [`de`]: ./de/index.html
|
| 41 | #![cfg_attr (
|
| 42 | feature = "document-features" ,
|
| 43 | cfg_attr(doc, doc = ::document_features::document_features!())
|
| 44 | )]
|
| 45 | #![forbid (unsafe_code)]
|
| 46 | #![deny (missing_docs)]
|
| 47 | #![recursion_limit = "1024" ]
|
| 48 | // Enable feature requirements in the docs from 1.57
|
| 49 | // See https://stackoverflow.com/questions/61417452
|
| 50 | #![cfg_attr (docs_rs, feature(doc_auto_cfg))]
|
| 51 |
|
| 52 | #[cfg (feature = "serialize" )]
|
| 53 | pub mod de;
|
| 54 | pub mod encoding;
|
| 55 | mod errors;
|
| 56 | mod escapei;
|
| 57 | pub mod escape {
|
| 58 | //! Manage xml character escapes
|
| 59 | pub use crate::escapei::{escape, partial_escape, unescape, unescape_with, EscapeError};
|
| 60 | }
|
| 61 | pub mod events;
|
| 62 | pub mod name;
|
| 63 | pub mod reader;
|
| 64 | #[cfg (feature = "serialize" )]
|
| 65 | pub mod se;
|
| 66 | #[cfg (feature = "serde-types" )]
|
| 67 | pub mod serde_helpers;
|
| 68 | /// Not an official API, public for integration tests
|
| 69 | #[doc (hidden)]
|
| 70 | pub mod utils;
|
| 71 | pub mod writer;
|
| 72 |
|
| 73 | // reexports
|
| 74 | pub use crate::encoding::Decoder;
|
| 75 | #[cfg (feature = "serialize" )]
|
| 76 | pub use crate::errors::serialize::DeError;
|
| 77 | pub use crate::errors::{Error, Result};
|
| 78 | pub use crate::reader::{NsReader, Reader};
|
| 79 | pub use crate::writer::{ElementWriter, Writer};
|
| 80 | |