Cargo Features

[dependencies]
actix-xml = { version = "0.2.0", default-features = false, features = ["compress-brotli", "compress-gzip", "compress-zstd", "encoding"] }
default = compress-brotli, compress-gzip, compress-zstd

These default features are set whenever actix-xml is added without default-features = false somewhere in the dependency tree.

compress-brotli default

Enables compress-brotli of actix-web

actix-web:

Brotli algorithm content-encoding support

compress-gzip default

Enables compress-gzip of actix-web

actix-web:

Gzip and deflate algorithms content-encoding support

compress-zstd default

Enables compress-zstd of actix-web

actix-web:

Zstd algorithm content-encoding support

encoding

Enables encoding of quick-xml ^0.22

quick-xml:

Enables support of non-UTF-8 encoded documents. Encoding will be inferred from the XML declaration if it is found, otherwise UTF-8 is assumed.

Currently, only ASCII-compatible encodings are supported. For example, UTF-16 will not work (therefore, quick-xml is not standard compliant).

Thus, quick-xml supports all encodings of encoding_rs except these:

You should stop processing a document when one of these encodings is detected, because generated events can be wrong and do not reflect a real document structure!

Because these are the only supported encodings that are not ASCII compatible, you can check for them:

use quick_xml::events::Event;
use quick_xml::reader::Reader;

let xml = to_utf16le_with_bom(r#"<?xml encoding='UTF-16'><element/>"#);
let mut reader = Reader::from_reader(xml.as_ref());
reader.config_mut().trim_text(true);

let mut buf = Vec::new();
let mut unsupported = false;
loop {
    if !reader.decoder().encoding().is_ascii_compatible() {
        unsupported = true;
        break;
    }
    buf.clear();
    match reader.read_event_into(&mut buf).unwrap() {
        Event::Eof => break,
        _ => {}
    }
}
assert_eq!(unsupported, true);

This restriction will be eliminated once issue #158 is resolved.

actix-xml has 5 features without comments.