{"record":{"id":"c3b758e65c61f382","repo":"pentaho/pentaho-kettle","slug":"getxmldata-log-unablecreatedocument-localized-message","errorCode":null,"errorMessage":"GetXMLData.Log.UnableCreateDocument (localized message)","messagePattern":"GetXMLData\\.Log\\.UnableCreateDocument \\(localized message\\)","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"plugins/xml/core/src/main/java/org/pentaho/di/trans/steps/getxmldata/GetXMLData.java","lineNumber":405,"sourceCode":"        if ( log.isDetailed() ) {\n          logDetailed( BaseMessages.getString( PKG, \"GetXMLData.Log.XMLStream\", meta.getXMLField(), Fieldvalue ) );\n        }\n\n        if ( meta.getIsAFile() ) {\n          FileObject file = null;\n          try {\n            // XML source is a file.\n            file = KettleVFS.getInstance( getTransMeta().getBowl() )\n              .getFileObject( environmentSubstitute( Fieldvalue ), getTransMeta() );\n\n            if ( meta.isIgnoreEmptyFile() && file.getContent().getSize() == 0 ) {\n              logBasic( BaseMessages.getString( PKG, \"GetXMLData.Error.FileSizeZero\", \"\" + file.getName() ) );\n              return ReadNextString();\n            }\n\n            // Open the XML document\n            if ( !setDocument( null, file, false, false ) ) {\n              throw new KettleException( BaseMessages.getString( PKG, \"GetXMLData.Log.UnableCreateDocument\" ) );\n            }\n\n            if ( !applyXPath() ) {\n              throw new KettleException( BaseMessages.getString( PKG, \"GetXMLData.Log.UnableApplyXPath\" ) );\n            }\n\n            addFileToResultFilesname( file );\n\n            if ( log.isDetailed() ) {\n              logDetailed( BaseMessages.getString( PKG, \"GetXMLData.Log.LoopFileOccurences\", \"\" + data.nodesize, file\n                  .getName().getBaseName() ) );\n            }\n\n          } catch ( Exception e ) {\n            throw new KettleException( e );\n          } finally {\n            try {\n              if ( file != null ) {","sourceCodeStart":387,"sourceCodeEnd":423,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/xml/core/src/main/java/org/pentaho/di/trans/steps/getxmldata/GetXMLData.java#L387-L423","documentation":"Thrown by ReadNextString when processing a file-based XML source: setDocument(null, file, false, false) returned false, meaning the XML document could not be built/parsed from the file. The step logs the localized 'UnableCreateDocument' message and aborts processing of that row/stream.","triggerScenarios":"setDocument fails for the current FileObject — typically a parser error from a malformed/non-well-formed XML file, an I/O error reading the file, or an unsupported encoding — during file-based (not field-based) input inside ReadNextString.","commonSituations":"Input file is truncated, HTML pretending to be XML, or contains invalid characters; file encoding (e.g. UTF-16 file read as UTF-8) misconfigured in the step; file locked or partially written by a producer when the step opens it.","solutions":["Validate the failing file with an XML parser (xmllint --noout file.xml) and fix or regenerate it.","Check the step's encoding setting matches the file's actual encoding (set the XML declaration encoding correctly).","Ensure the file is completely written before the transformation picks it up (file-watcher/trigger ordering).","If the file should be skipped, enable error handling on the step instead of letting it abort the transformation."],"exampleFix":"// before\nif ( !setDocument( null, file, false, false ) ) {\n  throw new KettleException( ... );\n}\n// after\nif ( !isWellFormedXml( file ) ) {\n  logError( \"Skipping malformed XML file: \" + file.getName().getBaseName() );\n  return ReadNextString(); // skip bad file\n}\nif ( !setDocument( null, file, false, false ) ) {\n  throw new KettleException( ... );\n}","handlingStrategy":"try-catch","validationCode":"// pre-validate file before the transformation\nProcess p = new ProcessBuilder(\"xmllint\", \"--noout\", xmlPath).start();\nif (p.waitFor() != 0) {\n  throw new IllegalStateException(\"Not well-formed XML: \" + xmlPath);\n}","typeGuard":null,"tryCatchPattern":"try {\n  trans.execute(null);\n} catch (KettleException e) {\n  if (e.getMessage().contains(\"UnableCreateDocument\")) {\n    logError(\"Malformed/unreadable XML input; check encoding and file integrity\");\n  } else { throw e; }\n}","preventionTips":["Validate generated XML files before handing them to PDI.","Match the step encoding setting to the files' real encoding.","Use write-then-rename so only complete files are processed.","Configure step error handling to route bad files aside in production."],"tags":["xml","parsing","file-io","kettle"],"backgroundTag":"xml-parse-error","analyzedSha":"f3058517a153da500bf4551f46d79b91bf8ec552","analyzedAt":"2026-09-13T14:04:16.340Z","contentChangedAt":"2026-09-13T14:04:16.340Z","schemaVersion":2},"datasetVersion":"2026-09-20T23:17:15.980Z"}