{"record":{"id":"f45fe03520f8c897","repo":"skylot/jadx","slug":"can-not-parse-xml-content","errorCode":null,"errorMessage":"Can not parse xml content","messagePattern":"Can not parse xml content","errorType":"exception","errorClass":"JadxRuntimeException","httpStatus":null,"severity":"error","filePath":"jadx-core/src/main/java/jadx/core/utils/android/AndroidManifestParser.java","lineNumber":219,"sourceCode":"\t\t\t\t\tisLauncherCategory = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (isMainAction && isLauncherCategory) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\n\tprivate Document parseXml(String xmlContent) {\n\t\ttry (InputStream xmlStream = new ByteArrayInputStream(xmlContent.getBytes(StandardCharsets.UTF_8))) {\n\t\t\tDocument document = security.parseXml(xmlStream);\n\t\t\tdocument.getDocumentElement().normalize();\n\t\t\treturn document;\n\t\t} catch (Exception e) {\n\t\t\tthrow new JadxRuntimeException(\"Can not parse xml content\", e);\n\t\t}\n\t}\n\n\tprivate @Nullable Document parseAppStrings(@Nullable ResContainer appStrings) {\n\t\tif (appStrings == null) {\n\t\t\treturn null;\n\t\t}\n\t\tString content = appStrings.getText().getCodeStr();\n\t\treturn parseXml(content);\n\t}\n\n\tprivate @Nullable Document parseAndroidManifest(ResourceFile androidManifest) {\n\t\tif (androidManifest == null) {\n\t\t\treturn null;\n\t\t}\n\t\tString content = androidManifest.loadContent().getText().getCodeStr();\n\t\treturn parseXml(content);\n\t}","sourceCodeStart":201,"sourceCodeEnd":237,"githubUrl":"https://github.com/skylot/jadx/blob/e738a26571d02919f01df40de93bc9a44dee4e18/jadx-core/src/main/java/jadx/core/utils/android/AndroidManifestParser.java#L201-L237","documentation":"AndroidManifestParser.parseXml() wraps any exception from the secure XML parser (IJadxSecurity.parseXml) when decoding manifest or app-string XML content into a DOM Document. The original exception is attached as the cause. It means the XML bytes could not be parsed as well-formed XML - typically because binary/AXML content was not fully converted to textual XML, the content is truncated, or it contains constructs the secure parser rejects (e.g. external entities blocked for security).","triggerScenarios":"parseXml(xmlContent) called with bytes that fail DocumentBuilderFactory parsing: malformed XML, partially-decoded binary AXML, truncation, or a security-policy rejection (XXE guard). Used by parseAndroidManifest() and parseAppStrings().","commonSituations":"A binary AndroidManifest that was not fully converted to text before parsing; an obfuscated APK with deliberately corrupted resources.arsc/strings.xml; a resource produced by a non-standard packager; very large or truncated resource content.","solutions":["Inspect getCause() on the JadxRuntimeException for the precise SAXE/IOException and the offending line/column.","Upgrade jadx - AXML/binary-XML decoding improvements ship regularly.","Re-obtain/re-sign the APK from a trusted source if the input is corrupt.","Skip manifest/app-string parsing if not needed and continue with code-only decompilation."],"exampleFix":"// before\nDocument doc = parser.parse(); // parseXml throws on bad content\n// after - tolerate malformed XML and degrade gracefully\ntry {\n    Document doc = parser.parse();\n} catch (JadxRuntimeException e) {\n    LOG.warn(\"Manifest XML parse failed, skipping: {}\", e.getCause().getMessage());\n}","handlingStrategy":"try-catch","validationCode":"// Lightweight well-formedness sniff before handing to the secure parser.\nString s = xmlContent.trim();\nif (s.isEmpty() || !(s.startsWith(\"<\") || s.startsWith(\"\\uFEFF<\"))) {\n    throw new IllegalArgumentException(\"Content does not look like XML\");\n}","typeGuard":null,"tryCatchPattern":"Document doc;\ntry {\n    doc = parser.parse();\n} catch (JadxRuntimeException e) {\n    LOG.warn(\"XML parse failed ({}); skipping\", e.getCause() == null ? \"\" : e.getCause().toString());\n    doc = null;\n}","preventionTips":["Always inspect getCause() to find the real SAXE/IOException.","Degrade gracefully: skip manifest/app-string parsing on malformed XML.","Upgrade jadx for AXML/binary-XML decoding improvements.","Validate inputs are well-formed when they come from untrusted/obfuscated sources."],"tags":["jadx","android","xml","resources","parsing"],"backgroundTag":null,"analyzedSha":"e738a26571d02919f01df40de93bc9a44dee4e18","analyzedAt":"2026-08-14T00:10:24.238Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}