Skip to main content

AXML

Struct AXML 

Source
pub struct AXML {
    pub root: Element,
}
Expand description

Represents an Android Binary XML (AXML) file.

This struct holds the root element of the parsed XML structure.

You can use this struct to traverse the XML tree, extract attributes, or get a string representation of the XML.

Fields§

§root: Element

Implementations§

Source§

impl AXML

Source

pub fn new(input: &mut &[u8], arsc: Option<&ARSC>) -> Result<AXML, AXMLError>

Parses a byte slice into an AXML structure.

§Example
let axml = AXML::new(&mut input_bytes, Some(&arsc))?;
Source

pub fn get_xml_string(&self) -> String

Returns the pretty-printed XML as a string.

§Example
let xml_string = axml.get_xml_string();
println!("{}", xml_string);
Source

pub fn get_attribute_value( &self, tag: &str, name: &str, arsc: Option<&ARSC>, ) -> Option<String>

Retrieves the value of an attribute from a specific tag.

Source

pub fn get_root_attribute_values<'a>( &'a self, tag: &'a str, name: &'a str, ) -> impl Iterator<Item = &'a str> + 'a

Returns an iterator over attribute values for direct children with a specific tag.

This is a faster version of AXML::get_all_attribute_values that only iterates over the root’s direct children

Source

pub fn get_all_attribute_values<'a>( &'a self, tag: &'a str, name: &'a str, ) -> impl Iterator<Item = &'a str> + 'a

Returns an iterator over attribute values for all descendants with a specific tag.

Source

pub fn get_main_activities(&self) -> impl Iterator<Item = &str>

Extracts the main launcher activities from an APK manifest.

Algorithm:

  1. Search for all <activity> and <activity-alias> tags.
  2. Look for android.intent.action.MAIN with android.intent.category.LAUNCHER or android.intent.category.INFO.

See: https://xrefandroid.com/android-16.0.0_r2/xref/frameworks/base/core/java/android/app/ApplicationPackageManager.java#310

Trait Implementations§

Source§

impl Debug for AXML

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for AXML

§

impl RefUnwindSafe for AXML

§

impl Send for AXML

§

impl Sync for AXML

§

impl Unpin for AXML

§

impl UnsafeUnpin for AXML

§

impl UnwindSafe for AXML

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.