{"record":{"id":"d7a2810de254fb32","repo":"flowable/flowable-engine","slug":"error-reading-xml-d7a281","errorCode":null,"errorMessage":"Error reading XML","messagePattern":"Error reading XML","errorType":"exception","errorClass":"DmnXMLException","httpStatus":null,"severity":"error","filePath":"modules/flowable-dmn-xml-converter/src/main/java/org/flowable/dmn/xml/converter/DmnXMLConverter.java","lineNumber":184,"sourceCode":"            XMLInputFactory xif = XMLInputFactory.newInstance();\n            XMLStreamReader xtr = xif.createXMLStreamReader(is);\n\n            return getTargetNameSpace(xtr);\n        } catch (XMLStreamException e) {\n            LOGGER.error(\"Error processing DMN document\", e);\n            throw new DmnXMLException(\"Error processing DMN document\", e);\n        }\n    }\n\n    protected String getTargetNameSpace(XMLStreamReader xmlStreamReader) {\n        String targetNameSpace = null;\n        try {\n            while (xmlStreamReader.hasNext()) {\n                try {\n                    xmlStreamReader.next();\n                } catch (Exception e) {\n                    LOGGER.debug(\"Error reading XML document\", e);\n                    throw new DmnXMLException(\"Error reading XML\", e);\n                }\n                targetNameSpace = xmlStreamReader.getNamespaceURI();\n                break;\n            }\n        } catch (XMLStreamException e) {\n            LOGGER.error(\"Error processing DMN document\", e);\n            throw new DmnXMLException(\"Error processing DMN document\", e);\n        }\n\n        return targetNameSpace;\n    }\n\n    protected Schema createSchema(String xsd) throws SAXException {\n        SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);\n        Schema schema = null;\n        if (classloader != null) {\n            schema = factory.newSchema(classloader.getResource(xsd));\n        }","sourceCodeStart":166,"sourceCodeEnd":202,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-dmn-xml-converter/src/main/java/org/flowable/dmn/xml/converter/DmnXMLConverter.java#L166-L202","documentation":"Inside getTargetNameSpace(XMLStreamReader), each call to xmlStreamReader.next() is individually wrapped: if advancing the reader throws (syntax error mid-document, encoding problem, IO failure under the reader), the exception is wrapped as DmnXMLException \"Error reading XML\". It distinguishes local parse failures from outer XMLStreamException handling.","triggerScenarios":"The XML stream reader hits malformed content while scanning for the first start element / namespace URI: invalid characters, mismatched tags, illegal byte sequences for the declared encoding.","commonSituations":"DMN files saved with wrong charset (e.g. UTF-16 content read as UTF-8); hand-edited XML with broken tags; binary data mistakenly stored as .dmn.xml; BOM/encoding conflicts.","solutions":["Re-encode the file to clean UTF-8 without BOM issues","Fix malformed tags/characters with an XML editor or xmllint","Re-export the decision table from the DMN modeler instead of hand-editing","Catch DmnXMLException around convertToDmnModel and log the underlying cause for the exact parse position"],"exampleFix":"// before: UTF-16 file fed with default UTF-8 reader\nnew InputStreamReader(in, StandardCharsets.UTF_8)\n// after: pass matching encoding to the converter\nconvertToDmnModel(inputStreamProvider, true, false, \"UTF-16\");","handlingStrategy":"validation","validationCode":"Charset declared = Charset.isSupported(encoding) ? Charset.forName(encoding) : StandardCharsets.UTF_8;\nnew String(Files.readAllBytes(path), declared); // smoke-test decodes without error","typeGuard":null,"tryCatchPattern":"try { converter.convertToDmnModel(provider, true, false, encoding); } catch (DmnXMLException e) { log.error(\"Error reading XML at parse level\", e.getCause()); }","preventionTips":["Save DMN files as clean UTF-8 without BOM","Don't hand-edit raw DMN XML; use a modeling tool","Standardize file encodings across repositories"],"tags":["xml","parsing","encoding"],"backgroundTag":"xml-parse-error","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-18T11:17:12.947Z"}