Skip to main content

convert compile xmltree file from android to classic xml

Project description

xmltree2xml

build pypi

xmltree2xml convert a compile xmltree from android to classic xml

Usage

usage: xmltree2xml [-h] [-n] [-r RESOURCES] [-o OUTPUT_DIR] [-f] file [file ...]

convert android xmltree to classic xml.

positional arguments:
  file                  xmltree file.

options:
  -h, --help            show this help message and exit
  -n, --no-header       do not add an xml header.
  -r RESOURCES, --resources RESOURCES
                        resource file for replace every hexa reference to human redable reference.
  -o OUTPUT_DIR, --output-dir OUTPUT_DIR
                        output directory.
  -f, --rename-file     rename output file with resource name.

Input file syntax

the android xml compile look like this

E: list (line=16)
  A: name="carrier_config_list" (Raw: "carrier_config_list")
    E: pbundle_as_map (line=17)
        E: string-array (line=19)
          A: name="mccmnc" (Raw: "mccmnc")
            E: item (line=20)
              A: value="TEST" (Raw: "TEST")
    E: pbundle_as_map (line=24)
        E: string-array (line=26)
          A: name="mccmnc" (Raw: "mccmnc")
            E: item (line=28)
              A: value=20601
            E: item (line=30)
              A: value=20810
            E: item (line=31)
              A: value=20826
        E: string (line=33)
          A: name="feature_flag_name" (Raw: "feature_flag_name")
            T: 'vvm_carrier_flag_el_telecom'
        E: int (line=34)
          A: name="vvm_port_number_int" (Raw: "vvm_port_number_int")
          A: value=5499
        E: string (line=37)
          A: name="vvm_destination_number_string" (Raw: "vvm_destination_number_string")
            T: '8860'
        E: string (line=38)
          A: name="vvm_type_string" (Raw: "vvm_type_string")
            T: 'vvm_type_omtp_1_3'
    E: pbundle_as_map (line=41)
        E: string-array (line=43)
          A: name="mccmnc" (Raw: "mccmnc")

and output look like this

<?xml version="1.0" encoding="utf-8"?>
<list name="carrier_config_list">
    <pbundle_as_map>
        <string-array name="mccmnc">
            <item value="TEST" />
        </string-array>
    </pbundle_as_map>
    <pbundle_as_map>
        <string-array name="mccmnc">
            <item value="20601" />
            <item value="20810" />
            <item value="20826" />
        </string-array>
        <string name="feature_flag_name">vvm_carrier_flag_el_telecom</string>
        <int name="vvm_port_number_int" value="5499" />
        <string name="vvm_destination_number_string">8860</string>
        <string name="vvm_type_string">vvm_type_omtp_1_3</string>
    </pbundle_as_map>
    <pbundle_as_map>
        <string-array name="mccmnc" />
    </pbundle_as_map>
</list>

Resource file

With resource file the reference @0x7f08013f has converted to real value @drawable/ic_shortcut_add_contact.

#  dump resource file with android sdk
aapt2 dump resource YOUR_APK > resourcefile.txt

#xmltree2xml
xmltree2xml -r resourcefile.txt LR.xmltree

Without

<shortcuts xmlns:android="http://schemas.android.com/apk/res/android">
    <shortcut android:icon="@0x7f08013f" android:enabled="true" android:shortcutId="dialer-shortcut-add-contact" android:shortcutShortLabel="@0x7f150287" android:shortcutLongLabel="@0x7f150286">
      <intent android:action="android.intent.action.INSERT" android:data="content://com.android.contacts/contacts" />
    </shortcut>
</shortcuts>

with

<shortcuts xmlns:android="http://schemas.android.com/apk/res/android">
    <shortcut android:icon="@drawable/ic_shortcut_add_contact" android:enabled="true" android:shortcutId="dialer-shortcut-add-contact" android:shortcutShortLabel="@string/dialer_shortcut_add_contact_short" android:shortcutLongLabel="@string/dialer_shortcut_add_contact_long">
        <intent android:action="android.intent.action.INSERT" android:data="content://com.android.contacts/contacts" />
    </shortcut>
</shortcuts>

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xmltree2xml-0.1.2.tar.gz (6.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

xmltree2xml-0.1.2-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

File details

Details for the file xmltree2xml-0.1.2.tar.gz.

File metadata

  • Download URL: xmltree2xml-0.1.2.tar.gz
  • Upload date:
  • Size: 6.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.5

File hashes

Hashes for xmltree2xml-0.1.2.tar.gz
Algorithm Hash digest
SHA256 d0b7d74ec458d1187df9626fba7011b06e7352d659f3744ad8f46a8b2c142a59
MD5 b62d2a50318931dc5bb9c1ddbfd945e3
BLAKE2b-256 0fb10636b94835e95440111a020134522461b2e98e624036a467b9239e88d390

See more details on using hashes here.

File details

Details for the file xmltree2xml-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: xmltree2xml-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 6.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.5

File hashes

Hashes for xmltree2xml-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ae8f59c3814c3802a005c2b23fcdae73f930653015150a5cdcb904cc1a4e1650
MD5 037442d68a2c57136b65db3f118aac38
BLAKE2b-256 77c69f00af5ab838b4363c5add8e713c2c0ca93e3f883cad62dd7c835c43a8cb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page