flowable/flowable-engine · error · DmnXMLException

Error reading XML

Error message

Error reading XML

What it means

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.

Solutions

  1. Re-encode the file to clean UTF-8 without BOM issues
  2. Fix malformed tags/characters with an XML editor or xmllint
  3. Re-export the decision table from the DMN modeler instead of hand-editing
  4. Catch DmnXMLException around convertToDmnModel and log the underlying cause for the exact parse position

Example fix

// before: UTF-16 file fed with default UTF-8 reader
new InputStreamReader(in, StandardCharsets.UTF_8)
// after: pass matching encoding to the converter
convertToDmnModel(inputStreamProvider, true, false, "UTF-16");
Defensive patterns

Strategy: validation

Validate before calling

Charset declared = Charset.isSupported(encoding) ? Charset.forName(encoding) : StandardCharsets.UTF_8;
new String(Files.readAllBytes(path), declared); // smoke-test decodes without error

Try / catch

try { converter.convertToDmnModel(provider, true, false, encoding); } catch (DmnXMLException e) { log.error("Error reading XML at parse level", e.getCause()); }

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11). Data as JSON: /api/errors/d7a2810de254fb32. Report an issue: GitHub.

Appendix: source

Thrown at modules/flowable-dmn-xml-converter/src/main/java/org/flowable/dmn/xml/converter/DmnXMLConverter.java:184

            XMLInputFactory xif = XMLInputFactory.newInstance();
            XMLStreamReader xtr = xif.createXMLStreamReader(is);

            return getTargetNameSpace(xtr);
        } catch (XMLStreamException e) {
            LOGGER.error("Error processing DMN document", e);
            throw new DmnXMLException("Error processing DMN document", e);
        }
    }

    protected String getTargetNameSpace(XMLStreamReader xmlStreamReader) {
        String targetNameSpace = null;
        try {
            while (xmlStreamReader.hasNext()) {
                try {
                    xmlStreamReader.next();
                } catch (Exception e) {
                    LOGGER.debug("Error reading XML document", e);
                    throw new DmnXMLException("Error reading XML", e);
                }
                targetNameSpace = xmlStreamReader.getNamespaceURI();
                break;
            }
        } catch (XMLStreamException e) {
            LOGGER.error("Error processing DMN document", e);
            throw new DmnXMLException("Error processing DMN document", e);
        }

        return targetNameSpace;
    }

    protected Schema createSchema(String xsd) throws SAXException {
        SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
        Schema schema = null;
        if (classloader != null) {
            schema = factory.newSchema(classloader.getResource(xsd));
        }

View on GitHub (pinned to d6d39ce1c6)