Uploaded image for project: 'Pentaho Data Integration - Kettle'
  1. Pentaho Data Integration - Kettle
  2. PDI-1223

AddXML Step can only add attributes to the root node

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Severity: Medium
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.1.0 GA
    • Component/s: None
    • Labels:
      None
    • Notice:
      When an issue is open, the "Fix Version/s" field conveys a target, not necessarily a commitment. When an issue is closed, the "Fix Version/s" field conveys the version that the issue was fixed in.

      Description

      Hello,

      The add XML step is limited to creating attributes only for the defined root node and does not allow to create the following xml structure considering a input stream with these three fields: element1, element2, version

      Target XML structure:
      <root>
      <element1>R58545458</element1>
      <element2 version="1.1"></element2>
      </root>

      The current Add XML step allows only to produce the following XML, any attribute is automatically part of the root element:

      <root version="1.1">
      <element1>R58545458</element1>
      <element2></element2>
      </root>

      Enclosed you will find an enhanced addXML step that allows to name the element to which an attribute belongs. A new column, attribute name, is added in the filed table, and the element name column is used to identify the name of the element that holds the attribute.

      Unfortunately the step is not 100% backward compatible, since in the original step the name of the attribute could be set using the element name column.

      Therefore I enclose the step as a plug-in, but it would be greatly appreciated if the step could either become part of the next PDI release or if you can find a way to make it backward compatible and add the feature to the current add XML step.

      Best regards,
      Ingo

      P.s.: I'll attach the source code, the plug-in distribution and a demo transformation

        Attachments

        1. addxml_src.zip
          48 kB
        2. addxmlplus_new.ktr
          5 kB
        3. addxmlplus_src.zip
          52 kB
        4. addxmlplus_src.zip
          52 kB
        5. addxmlplus_src.zip
          52 kB
        6. addxmlplus.ktr
          5 kB

          Activity

            People

            Assignee:
            gdavid Golda Thomas
            Reporter:
            iklose Ingo Klose
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: