<?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: Converting XML elements into Values in SAP CI in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/converting-xml-elements-into-values-in-sap-ci/qaa-p/12750403#M4785774</link>
    <description>&lt;P&gt; &lt;SPAN class="mention-scrubbed"&gt;karthikarjun&lt;/SPAN&gt; - Thanks for the comment. &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&amp;lt;root&amp;gt;
  &amp;lt;dynamic1&amp;gt;
     &amp;lt;dynamic2&amp;gt;
        &amp;lt;dynamic3&amp;gt;square&amp;lt;/dynamic3&amp;gt;&lt;BR /&gt;        &amp;lt;dynamic4&amp;gt;5&amp;lt;/dynamic4&amp;gt;&lt;BR /&gt;     &amp;lt;/dynamic2&amp;gt;&lt;BR /&gt;  &amp;lt;/dynamic1&amp;gt;&lt;BR /&gt;&amp;lt;/root&amp;gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The source field names can be dynamic. Is it possible to read and use it?&lt;/P&gt;</description>
    <pubDate>Tue, 04 Jul 2023 15:56:50 GMT</pubDate>
    <dc:creator>barath_dv</dc:creator>
    <dc:date>2023-07-04T15:56:50Z</dc:date>
    <item>
      <title>Converting XML elements into Values in SAP CI</title>
      <link>https://community.sap.com/t5/technology-q-a/converting-xml-elements-into-values-in-sap-ci/qaq-p/12750399</link>
      <description>&lt;P&gt;Experts,&lt;/P&gt;
  &lt;P&gt;Source Data&lt;/P&gt; 
  &lt;PRE&gt;&lt;CODE&gt;&amp;lt;root&amp;gt;
  &amp;lt;test&amp;gt;
     &amp;lt;product&amp;gt;
        &amp;lt;box&amp;gt;square&amp;lt;/box&amp;gt;
        &amp;lt;qty&amp;gt;5&amp;lt;/qty&amp;gt;
     &amp;lt;/product&amp;gt;
  &amp;lt;/test&amp;gt;
&amp;lt;/root&amp;gt;&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;Expected Data&lt;/P&gt; 
  &lt;PRE&gt;&lt;CODE&gt;&amp;lt;root&amp;gt;
  &amp;lt;Level1&amp;gt;test&amp;lt;Level1&amp;gt;
  &amp;lt;Level2&amp;gt;Product&amp;lt;Level2&amp;gt;
  &amp;lt;Level3&amp;gt;square&amp;lt;/Level3&amp;gt;
  &amp;lt;Level4&amp;gt;5&amp;lt;/Level4&amp;gt;
&amp;lt;/root&amp;gt;&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;Can you please advice me on how to achieve the above requirement?&lt;/P&gt;
  &lt;P&gt;TIA,&lt;/P&gt;
  &lt;P&gt;Barath&lt;/P&gt;</description>
      <pubDate>Thu, 22 Jun 2023 10:13:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/converting-xml-elements-into-values-in-sap-ci/qaq-p/12750399</guid>
      <dc:creator>barath_dv</dc:creator>
      <dc:date>2023-06-22T10:13:09Z</dc:date>
    </item>
    <item>
      <title>Re: Converting XML elements into Values in SAP CI</title>
      <link>https://community.sap.com/t5/technology-q-a/converting-xml-elements-into-values-in-sap-ci/qaa-p/12750400#M4785771</link>
      <description>&lt;P&gt;Hi, &lt;/P&gt;&lt;P&gt;It depends if the incoming messages are always the same structure? &lt;BR /&gt;If so, then you could use message mapping, create the source and target xsd accordingly. &lt;BR /&gt;Alternatively, you could do this with a groovy script which will be much more flexible. &lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;David &lt;/P&gt;</description>
      <pubDate>Thu, 22 Jun 2023 15:36:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/converting-xml-elements-into-values-in-sap-ci/qaa-p/12750400#M4785771</guid>
      <dc:creator>daviddasilva</dc:creator>
      <dc:date>2023-06-22T15:36:19Z</dc:date>
    </item>
    <item>
      <title>Re: Converting XML elements into Values in SAP CI</title>
      <link>https://community.sap.com/t5/technology-q-a/converting-xml-elements-into-values-in-sap-ci/qaa-p/12750401#M4785772</link>
      <description>&lt;P&gt;Hi, I can recommend you to use the XSLT to achieve your output&lt;/P&gt;&lt;P&gt;XSLT:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&amp;lt;xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&amp;gt;
  &amp;lt;xsl:output method="xml" indent="yes"/&amp;gt;


  &amp;lt;xsl:template match="/"&amp;gt;
    &amp;lt;root&amp;gt;
      &amp;lt;xsl:apply-templates select="root/test/product"/&amp;gt;
    &amp;lt;/root&amp;gt;
  &amp;lt;/xsl:template&amp;gt;


  &amp;lt;xsl:template match="product"&amp;gt;
    &amp;lt;Level1&amp;gt;
      &amp;lt;xsl:value-of select="ancestor::test[1]/name()"/&amp;gt;
    &amp;lt;/Level1&amp;gt;
    &amp;lt;Level2&amp;gt;
      &amp;lt;xsl:value-of select="name()"/&amp;gt;
    &amp;lt;/Level2&amp;gt;
    &amp;lt;xsl:apply-templates/&amp;gt;
  &amp;lt;/xsl:template&amp;gt;


  &amp;lt;xsl:template match="box"&amp;gt;
    &amp;lt;Level3&amp;gt;
      &amp;lt;xsl:value-of select="."/&amp;gt;
    &amp;lt;/Level3&amp;gt;
  &amp;lt;/xsl:template&amp;gt;


  &amp;lt;xsl:template match="qty"&amp;gt;
    &amp;lt;Level4&amp;gt;
      &amp;lt;xsl:value-of select="."/&amp;gt;
    &amp;lt;/Level4&amp;gt;
  &amp;lt;/xsl:template&amp;gt;


&amp;lt;/xsl:stylesheet&amp;gt;


&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Output:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&amp;lt;?xml version="1.0" encoding="UTF-8"?&amp;gt;
&amp;lt;root&amp;gt;
&amp;lt;Level1&amp;gt;test&amp;lt;/Level1&amp;gt;
&amp;lt;Level2&amp;gt;product&amp;lt;/Level2&amp;gt;
&amp;lt;Level3&amp;gt;square&amp;lt;/Level3&amp;gt;
&amp;lt;Level4&amp;gt;5&amp;lt;/Level4&amp;gt;
&amp;lt;/root&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 22 Jun 2023 16:48:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/converting-xml-elements-into-values-in-sap-ci/qaa-p/12750401#M4785772</guid>
      <dc:creator>arjun_kar</dc:creator>
      <dc:date>2023-06-22T16:48:15Z</dc:date>
    </item>
    <item>
      <title>Re: Converting XML elements into Values in SAP CI</title>
      <link>https://community.sap.com/t5/technology-q-a/converting-xml-elements-into-values-in-sap-ci/qaa-p/12750402#M4785773</link>
      <description>&lt;P&gt;Hi Barath&lt;/P&gt;&lt;P&gt;This is very hard to answer without some more detail. Is the above input and output data just a simplified example (one example out of possibly many), or is it the exact and only input and the exact output, you need produced? The latter is very easy, the former is potentially really quite hard &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Morten&lt;/P&gt;</description>
      <pubDate>Fri, 23 Jun 2023 11:11:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/converting-xml-elements-into-values-in-sap-ci/qaa-p/12750402#M4785773</guid>
      <dc:creator>MortenWittrock</dc:creator>
      <dc:date>2023-06-23T11:11:39Z</dc:date>
    </item>
    <item>
      <title>Re: Converting XML elements into Values in SAP CI</title>
      <link>https://community.sap.com/t5/technology-q-a/converting-xml-elements-into-values-in-sap-ci/qaa-p/12750403#M4785774</link>
      <description>&lt;P&gt; &lt;SPAN class="mention-scrubbed"&gt;karthikarjun&lt;/SPAN&gt; - Thanks for the comment. &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&amp;lt;root&amp;gt;
  &amp;lt;dynamic1&amp;gt;
     &amp;lt;dynamic2&amp;gt;
        &amp;lt;dynamic3&amp;gt;square&amp;lt;/dynamic3&amp;gt;&lt;BR /&gt;        &amp;lt;dynamic4&amp;gt;5&amp;lt;/dynamic4&amp;gt;&lt;BR /&gt;     &amp;lt;/dynamic2&amp;gt;&lt;BR /&gt;  &amp;lt;/dynamic1&amp;gt;&lt;BR /&gt;&amp;lt;/root&amp;gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The source field names can be dynamic. Is it possible to read and use it?&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jul 2023 15:56:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/converting-xml-elements-into-values-in-sap-ci/qaa-p/12750403#M4785774</guid>
      <dc:creator>barath_dv</dc:creator>
      <dc:date>2023-07-04T15:56:50Z</dc:date>
    </item>
    <item>
      <title>Re: Converting XML elements into Values in SAP CI</title>
      <link>https://community.sap.com/t5/technology-q-a/converting-xml-elements-into-values-in-sap-ci/qaa-p/12750404#M4785775</link>
      <description>&lt;P&gt;  &lt;SPAN class="mention-scrubbed"&gt;daviddasilva&lt;/SPAN&gt; - Thanks for the comment.&lt;/P&gt;&lt;P&gt;The structure will be dynamic so we cannot make use of message mapping. &lt;/P&gt;</description>
      <pubDate>Tue, 04 Jul 2023 15:58:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/converting-xml-elements-into-values-in-sap-ci/qaa-p/12750404#M4785775</guid>
      <dc:creator>barath_dv</dc:creator>
      <dc:date>2023-07-04T15:58:27Z</dc:date>
    </item>
    <item>
      <title>Re: Converting XML elements into Values in SAP CI</title>
      <link>https://community.sap.com/t5/technology-q-a/converting-xml-elements-into-values-in-sap-ci/qaa-p/12750405#M4785776</link>
      <description>&lt;P&gt;HI &lt;SPAN class="mention-scrubbed"&gt;barath.v&lt;/SPAN&gt; - In the general scenario, the inbound message does not adhere to a specific pattern for data handling. Instead, it is dynamic, indicating the presence of unstructured data. This situation can be both intriguing and challenging.&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jul 2023 10:32:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/converting-xml-elements-into-values-in-sap-ci/qaa-p/12750405#M4785776</guid>
      <dc:creator>arjun_kar</dc:creator>
      <dc:date>2023-07-07T10:32:23Z</dc:date>
    </item>
  </channel>
</rss>

