Checked Android binary XML decoding, XML rendering and manifest metadata in pure MoonBit
cd playground
pnpm install --frozen-lockfile
pnpm devgit clone https://github.com/LING71671/moonbit-axml.git
cd moonbit-axml
moon run src/cmd/axml --target js -- inspect --json fixtures/valid/manifest_basic.axmlmoon run src/cmd/axml --target js -- decode fixtures/valid/manifest_unicode.axml
moon run src/cmd/axml --target js -- decode --pretty fixtures/valid/manifest_basic.axml
moon run src/cmd/axml --target js -- intents --json fixtures/valid/manifest_basic.axml
moon run src/cmd/axml --target js -- validate fixtures/valid/menu.axml
moon run src/cmd/axml --target js -- validate --json fixtures/valid/menu.axml
moon run src/cmd/axml --target js -- stats --json fixtures/valid/menu.axml
moon run src/cmd/axml --target js -- refs --json fixtures/valid/menu.axmlmoon run src/cmd/axml-native --target native -- inspect --json fixtures/valid/manifest_basic.axmlmoon add LING71671/axml@0.1.0let document = @axml.decode(input)
let xml = @axml.to_xml(document)
let manifest = @axml.inspect_manifest(document)| API | Use |
|---|---|
| XML rendering | Choose compact to_xml or bounded to_xml_pretty, preserving mixed-text subtrees |
| Document queries and statistics | Select expanded names and summarize stored pools, events, and depth |
| Typed value views and dimensions/fractions | Read typed payloads and encoded units without coercion or display metrics |
| Manifest helpers and intent filters | Inspect component, permission, action/category, and data declarations without platform defaults |
| Resource references | Retain every reference kind, ID, location, and attribute/text origin |
| Batch catalog | Import LING71671/axml/catalog to process named byte inputs with independent results and diagnostics |
moon fmt --check
moon check --target all --deny-warn
moon test --target wasm-gc --deny-warn
moon test --target js --deny-warn
moon test --target native --deny-warn
python scripts/verify_cli.py| Limit | Default |
|---|---|
| Input | 16 MiB |
| String pool | 100,000 entries; 4,194,304 aggregate UTF-16 units |
| Nesting | 256 elements |
| Events / attributes | 500,000 events; 65,535 attributes per element |
| Rendered output | 33,554,432 UTF-16 units |
pub(all) struct Attribute {
namespace_uri : String?
name : String
resource_id : UInt?
raw_value : String?
value : TypedValue
} derive(Eq, Debug, ToJson)pub(all) struct Manifest {
package_name : String
version_code : Attribute?
version_code_major : Attribute?
version_name : Attribute?
sdk : ManifestSdk?
permissions : Array[ManifestPermission]
application : ManifestApplication?
components : Array[ManifestComponent]
} derive(Eq, Debug, ToJson)fn ManifestComponent::qualified_name(self : ManifestComponent, package_name : String) -> String? raise DecodeErrorpub(all) struct ResourceUsage {
offset : Int
line_number : UInt
origin : ResourceUsageOrigin
reference : ValueReference
} derive(Eq, Debug, ToJson)fn resolve_component_name(package_name : String, declared_name : String) -> String raise DecodeErrorfn to_xml_pretty(document : Document, max_output_chars? : Int, max_depth? : Int) -> String raise DecodeErrorInstall
Download zipChecked Android binary XML decoding, XML rendering and manifest metadata in pure MoonBit