<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>Question Re: Groovy Script: Add new node in existing XML in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/groovy-script-add-new-node-in-existing-xml/qaa-p/12702863#M4766530</link>
    <description>&lt;P&gt;Hi &lt;SPAN class="mention-scrubbed"&gt;taciturn&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;Having some sort of XML IDE definitely helps. You can do without, but your life will be easier with an IDE. XSLT does have a fairly steep learning curve, so it might make sense to find a book or a course to get you started.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Morten&lt;/P&gt;</description>
    <pubDate>Mon, 20 Mar 2023 11:31:50 GMT</pubDate>
    <dc:creator>MortenWittrock</dc:creator>
    <dc:date>2023-03-20T11:31:50Z</dc:date>
    <item>
      <title>Groovy Script: Add new node in existing XML</title>
      <link>https://community.sap.com/t5/technology-q-a/groovy-script-add-new-node-in-existing-xml/qaq-p/12702857</link>
      <description>&lt;P&gt;Hi Experts, &lt;BR /&gt;Can you please suggest how to write groovy script to add new element in the existing XML payload &lt;BR /&gt;&lt;BR /&gt;my input would be &lt;/P&gt;
  &lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/2145910-image.png" /&gt;&lt;/P&gt;
  &lt;P&gt;I need to get below like this &lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
  &lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/2145911-image.png" /&gt;&lt;/P&gt;
  &lt;P&gt;Any suggestion Pls.&lt;/P&gt;
  &lt;P&gt;Regards,&lt;/P&gt;
  &lt;P&gt;Jas&lt;/P&gt;</description>
      <pubDate>Wed, 08 Mar 2023 14:29:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/groovy-script-add-new-node-in-existing-xml/qaq-p/12702857</guid>
      <dc:creator>sabana1705</dc:creator>
      <dc:date>2023-03-08T14:29:37Z</dc:date>
    </item>
    <item>
      <title>Re: Groovy Script: Add new node in existing XML</title>
      <link>https://community.sap.com/t5/technology-q-a/groovy-script-add-new-node-in-existing-xml/qaa-p/12702858#M4766525</link>
      <description>&lt;P&gt;XSLT makes quick work of such a request.&lt;/P&gt;</description>
      <pubDate>Wed, 08 Mar 2023 14:42:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/groovy-script-add-new-node-in-existing-xml/qaa-p/12702858#M4766525</guid>
      <dc:creator>Ryan-Crosby</dc:creator>
      <dc:date>2023-03-08T14:42:00Z</dc:date>
    </item>
    <item>
      <title>Re: Groovy Script: Add new node in existing XML</title>
      <link>https://community.sap.com/t5/technology-q-a/groovy-script-add-new-node-in-existing-xml/qaa-p/12702859#M4766526</link>
      <description>&lt;P&gt;Hi Sabana,&lt;/P&gt;&lt;P&gt;You can use appendNode method.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;GroupValue.appendNode {
  ProductComponent('Dummy')
}&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 08 Mar 2023 16:47:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/groovy-script-add-new-node-in-existing-xml/qaa-p/12702859#M4766526</guid>
      <dc:creator>PriyankaChak</dc:creator>
      <dc:date>2023-03-08T16:47:44Z</dc:date>
    </item>
    <item>
      <title>Re: Groovy Script: Add new node in existing XML</title>
      <link>https://community.sap.com/t5/technology-q-a/groovy-script-add-new-node-in-existing-xml/qaa-p/12702860#M4766527</link>
      <description>&lt;P&gt;Hi Sabana&lt;/P&gt;&lt;P&gt;As &lt;SPAN class="mention-scrubbed"&gt;ryan.crosby2&lt;/SPAN&gt; points out, this problem is a very good match for XSLT. This short stylesheet inserts the extra elements:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&amp;lt;?xml version="1.0" encoding="UTF-8"?&amp;gt;&lt;BR /&gt;&amp;lt;xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="3.0"&amp;gt;&lt;BR /&gt;    &amp;lt;xsl:mode on-no-match="shallow-copy"/&amp;gt;&lt;BR /&gt;    &amp;lt;xsl:template match="GroupValue"&amp;gt;&lt;BR /&gt;        &amp;lt;xsl:copy&amp;gt;&lt;BR /&gt;            &amp;lt;xsl:apply-templates/&amp;gt;&lt;BR /&gt;            &amp;lt;CommercialParameters&amp;gt;&lt;BR /&gt;                &amp;lt;ProductComponent&amp;gt;Dummy&amp;lt;/ProductComponent&amp;gt;&lt;BR /&gt;            &amp;lt;/CommercialParameters&amp;gt;&lt;BR /&gt;        &amp;lt;/xsl:copy&amp;gt;&lt;BR /&gt;    &amp;lt;/xsl:template&amp;gt;&lt;BR /&gt;&amp;lt;/xsl:stylesheet&amp;gt;&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Morten&lt;/P&gt;</description>
      <pubDate>Wed, 08 Mar 2023 21:28:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/groovy-script-add-new-node-in-existing-xml/qaa-p/12702860#M4766527</guid>
      <dc:creator>MortenWittrock</dc:creator>
      <dc:date>2023-03-08T21:28:01Z</dc:date>
    </item>
    <item>
      <title>Re: Groovy Script: Add new node in existing XML</title>
      <link>https://community.sap.com/t5/technology-q-a/groovy-script-add-new-node-in-existing-xml/qaa-p/12702861#M4766528</link>
      <description>&lt;P&gt;My preferred approach is XSLT only  but we can try for few cases &lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;${bodyAs(String).replace('&amp;lt;/GroupValue&amp;gt;','&amp;lt;Notification&amp;gt;Dummy&amp;lt;/Notification&amp;gt;&amp;lt;/GroupValue&amp;gt;')}&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/2145921-image.png" /&gt;&lt;/P&gt;&lt;P&gt;Input&lt;/P&gt;&lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/2145922-image.png" /&gt;&lt;/P&gt;&lt;P&gt;Output&lt;/P&gt;&lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/2145923-image.png" /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Mar 2023 22:31:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/groovy-script-add-new-node-in-existing-xml/qaa-p/12702861#M4766528</guid>
      <dc:creator>RameshVaranganti</dc:creator>
      <dc:date>2023-03-08T22:31:49Z</dc:date>
    </item>
    <item>
      <title>Re: Groovy Script: Add new node in existing XML</title>
      <link>https://community.sap.com/t5/technology-q-a/groovy-script-add-new-node-in-existing-xml/qaa-p/12702862#M4766529</link>
      <description>&lt;P&gt;Hi Mortten,&lt;/P&gt;&lt;P&gt;which tool do you use to play around XSLT mapping and do you have any specific go to knowledge base for learning more about XSLT mapping.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Sai Krishna V&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.linkedin.com/in/viragandham-sai-krishna-818a38161/" target="_blank"&gt;LinkedIn&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Mar 2023 05:03:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/groovy-script-add-new-node-in-existing-xml/qaa-p/12702862#M4766529</guid>
      <dc:creator>saikrishna7029</dc:creator>
      <dc:date>2023-03-09T05:03:47Z</dc:date>
    </item>
    <item>
      <title>Re: Groovy Script: Add new node in existing XML</title>
      <link>https://community.sap.com/t5/technology-q-a/groovy-script-add-new-node-in-existing-xml/qaa-p/12702863#M4766530</link>
      <description>&lt;P&gt;Hi &lt;SPAN class="mention-scrubbed"&gt;taciturn&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;Having some sort of XML IDE definitely helps. You can do without, but your life will be easier with an IDE. XSLT does have a fairly steep learning curve, so it might make sense to find a book or a course to get you started.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Morten&lt;/P&gt;</description>
      <pubDate>Mon, 20 Mar 2023 11:31:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/groovy-script-add-new-node-in-existing-xml/qaa-p/12702863#M4766530</guid>
      <dc:creator>MortenWittrock</dc:creator>
      <dc:date>2023-03-20T11:31:50Z</dc:date>
    </item>
  </channel>
</rss>

