{"record":{"id":"75d870e3459eb658","repo":"pentaho/pentaho-kettle","slug":"getxmldata-log-unableapplyxpath-localized-message","errorCode":null,"errorMessage":"GetXMLData.Log.UnableApplyXPath (localized message)","messagePattern":"GetXMLData\\.Log\\.UnableApplyXPath \\(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":242,"sourceCode":"    // we're processing one row at a time through here.\n    if ( data.PathValue.equals( data.prunePath ) ) {\n      data.an.set( 0, (AbstractNode) row );\n      data.nodesize = 1; // it's always just one row.\n      data.nodenr = 0;\n      if ( log.isDebug() ) {\n        logDebug( BaseMessages.getString( PKG, \"GetXMLData.Log.StreamingMode.ProcessingRows\" ) );\n      }\n      Object[] r = getXMLRowPutRowWithErrorhandling();\n      if ( !data.errorInRowButContinue ) { // do not put out the row but continue\n        putRowOut( r ); // false when limit is reached, functionality is there but we can not stop reading the hole file\n                        // (slow but works)\n      }\n      data.nodesize = 0;\n      data.nodenr = 0;\n      return;\n    } else {\n      if ( !applyXPath() ) {\n        throw new KettleException( BaseMessages.getString( PKG, \"GetXMLData.Log.UnableApplyXPath\" ) );\n      }\n    }\n    // main loop through the data until limit is reached or transformation is stopped\n    // similar functionality like in BaseStep.runStepThread\n    if ( log.isDebug() ) {\n      logDebug( BaseMessages.getString( PKG, \"GetXMLData.Log.StreamingMode.ProcessingRows\" ) );\n    }\n    boolean cont = true;\n    while ( data.nodenr < data.nodesize && cont && !isStopped() ) {\n      Object[] r = getXMLRowPutRowWithErrorhandling();\n      if ( data.errorInRowButContinue ) {\n        continue; // do not put out the row but continue\n      }\n      cont = putRowOut( r ); // false when limit is reached, functionality is there but we can not stop reading the hole\n                             // file (slow but works)\n    }\n    if ( log.isDebug() ) {\n      logDebug( BaseMessages.getString( PKG, \"GetXMLData.Log.StreamingMode.FreeMemory\" ) );","sourceCodeStart":224,"sourceCodeEnd":260,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/xml/core/src/main/java/org/pentaho/di/trans/steps/getxmldata/GetXMLData.java#L224-L260","documentation":"In streaming mode, processStreaming calls applyXPath() to locate matching nodes for the current document fragment. If applyXPath returns false, the step throws a KettleException carrying the localized message GetXMLData.Log.UnableApplyXPath — meaning the XPath could not be applied to the streamed document.","triggerScenarios":"onEnd triggers processStreaming for a row and applyXPath() returns false — typically an invalid XPath expression, or the XPath cannot be compiled/evaluated against the dom4j document in streaming mode.","commonSituations":"Typo or unsupported syntax in the XPath field; XPath using features unsupported by the streaming parser; document fragment missing the nodes the XPath expects.","solutions":["Correct the XPath expression in the step's 'Loop XPath' / field XPath settings","Test the XPath against a sample document in a tool like XPath tester before using it in streaming mode","Validate the document structure matches the streaming loop path","Use non-streaming mode temporarily to get more detailed XPath errors"],"exampleFix":"// before\nLoop XPath: //records/record[@id]\n// after (valid, simpler XPath)\nLoop XPath: //records/record","handlingStrategy":"validation","validationCode":"try {\n  org.dom4j.DocumentHelper.createXPath(loopXPath);\n  org.dom4j.DocumentHelper.createXPath(fieldXPath);\n} catch (Exception e) {\n  failFast(\"Invalid XPath in GetXMLData config: \" + e.getMessage());\n}","typeGuard":null,"tryCatchPattern":"try { runTransformation(); }\ncatch (KettleException ke) {\n  if (ke.getMessage() != null && ke.getMessage().contains(\"Could not apply XPath\")) {\n    logError(\"Fix Loop XPath / field XPath in GetXMLData settings\");\n  }\n}","preventionTips":["Keep XPath expressions simple and dom4j-compatible in streaming mode","Test XPaths with a sample document first","Verify namespaces are handled consistently between mode and expression"],"tags":["xml","xpath","streaming","kettle"],"backgroundTag":"xpath-expression-invalid","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"}