{"record":{"id":"402284461dce0040","repo":"flowable/flowable-engine","slug":"error-processing-dmn-document","errorCode":null,"errorMessage":"Error processing DMN document","messagePattern":"Error processing DMN document","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":172,"sourceCode":"            schema = createSchema(DMN_XSD);\n        } else if (DMN_12_TARGET_NAMESPACE.equals(targetNameSpace)) {\n            schema = createSchema(DMN_12_XSD);\n        } else {\n            schema = createSchema(DMN_11_XSD);\n        }\n        Validator validator = schema.newValidator();\n        validator.validate(new StAXSource(xmlStreamReader));\n    }\n\n    protected String getTargetNameSpace(InputStream is) {\n        try {\n            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);","sourceCodeStart":154,"sourceCodeEnd":190,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-dmn-xml-converter/src/main/java/org/flowable/dmn/xml/converter/DmnXMLConverter.java#L154-L190","documentation":"DmnXMLConverter.getTargetNameSpace(InputStream) creates an XMLStreamReader over the DMN document to detect the DMN version namespace. If the underlying stream cannot be parsed (malformed XML, premature EOF), the XMLStreamException is wrapped as DmnXMLException \"Error processing DMN document\".","triggerScenarios":"Calling DmnXMLConverter.convertToDmnModel with schema validation enabled on an InputStream whose XML cannot be read/parsed during namespace detection: corrupt file, empty file, truncated XML, invalid prolog.","commonSituations":"Corrupted DMN files committed to resources; truncated uploads; files that are actually HTML error pages or wrong format saved with .dmn.xml extension; encoding issues breaking the XML prolog.","solutions":["Validate the DMN file is well-formed XML in an editor/xmllint before deploying","Check the file is complete and not truncated (compare size/hash with source)","Ensure the file starts with a valid XML declaration and root element","Regenerate or re-export the DMN file from the DMN modeling tool"],"exampleFix":"// before\ncat broken.dmn.xml | head -c 50  // truncated output\n// after\nxmllint --noout decision.dmn.xml  // confirms well-formedness before deploy","handlingStrategy":"validation","validationCode":"try { XMLInputFactory.newInstance().createXMLStreamReader(new FileInputStream(f)).close(); } catch (XMLStreamException e) { throw new IllegalStateException(\"Not well-formed XML: \" + f, e); }","typeGuard":null,"tryCatchPattern":"try { converter.convertToDmnModel(provider, true, false); } catch (DmnXMLException e) { log.error(\"DMN parse failed\", e.getCause()); }","preventionTips":["Run xmllint --noout on DMN files as a build/deploy step","Never store non-XML content (HTML errors, binaries) under .dmn.xml names","Re-export DMN files from the modeler rather than hand-editing"],"tags":["xml","parsing","dmn"],"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"}