Skip to main content

Module xml

Module xml 

Source
Expand description

Android binary XML (AXML): the compiled form of AndroidManifest.xml and res/xml/* files.

Document is a typed element tree. Build one in code, parse it from text with Document::parse, or decode a compiled file with Document::decode; Document::encode compiles it, and its Display implementation prints readable XML.

use apk::android::attr;
use apk::xml::{Document, Element};

let manifest = Element::new("manifest")
    .with_android_namespace()
    .with_attr("package", "org.example.app")
    .with_attr(attr::VERSION_CODE, 3)
    .with_child(Element::new("uses-sdk").with_attr(attr::MIN_SDK_VERSION, 24));
let document = Document::new(manifest);
let compiled = document.encode(&())?;
assert_eq!(Document::decode(&compiled)?, document);

Re-exports§

pub use crate::android::NAMESPACE as ANDROID_NAMESPACE;

Structs§

AttrName
An attribute’s qualified name.
Attribute
A name and a typed value.
Document
An XML document with a single root element.
Element
An XML element.
Namespace
An xmlns:prefix="uri" declaration.

Enums§

Node
A child of an Element.
NodeKind
The binary XML node a XmlError::TruncatedNode refers to.
XmlError
Why a binary or text XML document could not be processed.

Constants§

MAX_DEPTH
The deepest element nesting accepted when decoding, parsing, or encoding.