Search code examples
xmlxpathkettle

how set up correct xpath


i want generate list output in Keetle Spoon:

system_name, productname

example:

JOHN Adobe Reader XI (11.0.01)
JOHN D3DX10
JOHN Google Drive
JOHN Adobe Flash Player 11 ActiveX
JOHN Adobe Flash Player 11 Plugin

From xml file:

<computer>
 <system name="JOHN" />
 <operatingsystem name="Microsoft Windows 7 Professional " servicepack="Service Pack 1" />
 <windowscomponents>
  <component name="Windows Media Player (from Start Menu and Desktop)" class="2200" classname="" level="1" />
 </windowscomponents>
 <installedapplications>
  <msiapplication productname="Adobe Reader XI (11.0.01)" vendor="Adobe Systems Incorporated" version="11.0.01" installdate="20130111" />
  <msiapplication productname="D3DX10" vendor="Microsoft" version="15.4.2368.0902" installdate="20121219" />
  <msiapplication productname="Google Drive" vendor="Google, Inc." version="1.7.4018.3496" installdate="20130108" />
  <regapplication productname="Adobe Flash Player 11 ActiveX" version="11.5.502.146" />
  <regapplication productname="Adobe Flash Player 11 Plugin" version="11.5.502.146" />
 </installedapplications>
</computer>

I use settings: Loop XPath /computer

Fields:

  1. system/@name
  2. installedapplications/msiapplication/@productname
  3. installedapplications/regapplication/@productname

but I only get rows:

JOHN Adobe Reader XI (11.0.01)
JOHN Adobe Flash Player 11 ActiveX

Solution

  • All I know about Kettle spoon was from answering your earlier question, but I believe you should use the following:

    Loop XPath /computer/installedapplications/*
    

    Fields

    ../../system/@name
    @productname