How can I parse a binary xml file like AndroidManifest.xml in C or C++?

  android-manifest, c++, pugixml, xml, xml-parsing

I want to parse AndroidManifest.xml (without using apktool) in C or C++. To do so, I used pugixml library to parse the XML file, but it failed to parse. I tried different encoding for reading XML such as pugi::encoding_wchar , pugi::encoding_utf16, pugi::encoding_utf8 but none of them worked. I also tried with libxml, but it failed too.

This is link to download AndroidManifest.xml

#include <pugixml.hpp>
using namespace std;

int main()
{
    pugi::xml_document doc;
    pugi::xml_parse_result result = doc.load_file("AndroidManifest.xml");
    
    // Load result: No document element found
    std::cout << "Load result: " << result.description();

    if (!result)
        return -1;
}

Source: Windows Questions C++

LEAVE A COMMENT