{"record":{"id":"ab11d67ea192a79f","repo":"MuntashirAkon/AppManager","slug":"namespaces-are-not-supported-binaryxmlserializer","errorCode":null,"errorMessage":"Namespaces are not supported","messagePattern":"Namespaces are not supported","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"libcore/compat/src/main/java/io/github/muntashirakon/compat/xml/BinaryXmlSerializer.java","lineNumber":383,"sourceCode":"    public Object getProperty(String name) {\n        // Properties are not supported\n        throw new UnsupportedOperationException();\n    }\n\n    @Override\n    public void setPrefix(String prefix, String namespace) {\n        // Prefixes are not supported\n        throw new UnsupportedOperationException();\n    }\n\n    @Override\n    public String getPrefix(String namespace, boolean generatePrefix) {\n        // Prefixes are not supported\n        throw new UnsupportedOperationException();\n    }\n\n    private static IllegalArgumentException illegalNamespace() {\n        throw new IllegalArgumentException(\"Namespaces are not supported\");\n    }\n}","sourceCodeStart":365,"sourceCodeEnd":385,"githubUrl":"https://github.com/MuntashirAkon/AppManager/blob/0152f468fc9463ee02dc2ca83f6fe4989a2c4ca5/libcore/compat/src/main/java/io/github/muntashirakon/compat/xml/BinaryXmlSerializer.java#L365-L385","documentation":"BinaryXmlSerializer does not support XML namespaces: illegalNamespace() throws IllegalArgumentException whenever a non-null namespace is supplied to startTag, endTag, attribute, attributeInterned, attributeBytesHex, or attributeBytesBase64.","triggerScenarios":"Calling serializer.startTag(\"http://example.com/ns\", \"tag\"), serializer.attribute(ns, name, value), or any of the attribute* variants with a non-null namespace string.","commonSituations":"Porting code from XmlSerializer/Xml.newSerializer which accepts namespaces, or generating documents that originally used namespaced elements — Android's binary XML format intentionally drops namespace support.","solutions":["Pass null as the namespace argument to all serializer calls.","Encode the namespace into the tag/attribute name (e.g. \"ns:name\") if namespacing semantics are needed.","Switch to a namespaces-capable serializer (Xml.newSerializer with FEATURE_PROCESS_NAMESPACES) if namespaces are required.","Refactor the document schema to avoid namespaces entirely."],"exampleFix":"// before\nserializer.startTag(\"http://schemas.android.com/apk/res/android\", \"manifest\");\n// after\nserializer.startTag(null, \"manifest\");","handlingStrategy":"validation","validationCode":"if (namespace != null) {\n    throw new IllegalStateException(\"BinaryXmlSerializer does not support namespaces; pass null\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    serializer.startTag(ns, name);\n} catch (IllegalArgumentException e) {\n    serializer.startTag(null, name); // retry namespace-free\n}","preventionTips":["Always pass null as the namespace to every BinaryXmlSerializer call.","Wrap the serializer behind your own facade that drops namespaces.","If namespaces are required, use Xml.newSerializer with namespace processing instead.","Encode namespace semantics into element/attribute names if needed."],"tags":["xml","serializer","namespaces"],"backgroundTag":"unsupported-operation","analyzedSha":"0152f468fc9463ee02dc2ca83f6fe4989a2c4ca5","analyzedAt":"2026-09-12T14:03:37.243Z","contentChangedAt":"2026-09-12T14:03:37.243Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}