<?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>topic Converting XML string to internal table in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/converting-xml-string-to-internal-table/m-p/7705618#M1578478</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying to convert an XML string to an internal table. The format of the XML string is as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;node label="Compressors" NODE_ID="783" checked="1" expandStatus="false"&amp;gt;&lt;/P&gt;&lt;P&gt;   &amp;lt;node label="Nail guns" NODE_ID="78543" checked="1" expandStatus="false"/&amp;gt;&lt;/P&gt;&lt;P&gt;   &amp;lt;node label="Spray guns" NODE_ID="855" checked="0" expandStatus="false"/&amp;gt;&lt;/P&gt;&lt;P&gt;   &amp;lt;node label="Cleaning equipment" NODE_ID="9" checked="1" expandStatus="false"/&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;/node&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I need is an internal table with the fields &lt;STRONG&gt;NODE_ID&lt;/STRONG&gt; and &lt;STRONG&gt;checked&lt;/STRONG&gt; filled. The hierarchy here doesn't matter, so I just need an internal table of a structure with 2 fields. The whole XML is hierarchical and contains only the &amp;lt;node&amp;gt; tag, which can be self-closing or not with the attributes within the tag.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What is the best way to accomplish this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Performance here is quite important too, as this XML can contain over 100,000 nodes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Should it be done with an xpath expression, with a regex, with the iXML parser, an XSLT call transformation?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help is greatly appreciated!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Vincent&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 05 Mar 2011 05:18:39 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2011-03-05T05:18:39Z</dc:date>
    <item>
      <title>Converting XML string to internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/converting-xml-string-to-internal-table/m-p/7705618#M1578478</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying to convert an XML string to an internal table. The format of the XML string is as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;node label="Compressors" NODE_ID="783" checked="1" expandStatus="false"&amp;gt;&lt;/P&gt;&lt;P&gt;   &amp;lt;node label="Nail guns" NODE_ID="78543" checked="1" expandStatus="false"/&amp;gt;&lt;/P&gt;&lt;P&gt;   &amp;lt;node label="Spray guns" NODE_ID="855" checked="0" expandStatus="false"/&amp;gt;&lt;/P&gt;&lt;P&gt;   &amp;lt;node label="Cleaning equipment" NODE_ID="9" checked="1" expandStatus="false"/&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;/node&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I need is an internal table with the fields &lt;STRONG&gt;NODE_ID&lt;/STRONG&gt; and &lt;STRONG&gt;checked&lt;/STRONG&gt; filled. The hierarchy here doesn't matter, so I just need an internal table of a structure with 2 fields. The whole XML is hierarchical and contains only the &amp;lt;node&amp;gt; tag, which can be self-closing or not with the attributes within the tag.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What is the best way to accomplish this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Performance here is quite important too, as this XML can contain over 100,000 nodes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Should it be done with an xpath expression, with a regex, with the iXML parser, an XSLT call transformation?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help is greatly appreciated!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Vincent&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 05 Mar 2011 05:18:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/converting-xml-string-to-internal-table/m-p/7705618#M1578478</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-03-05T05:18:39Z</dc:date>
    </item>
    <item>
      <title>Re: Converting XML string to internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/converting-xml-string-to-internal-table/m-p/7705619#M1578479</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, &lt;/P&gt;&lt;P&gt;did you manage to get this to work? &lt;/P&gt;&lt;P&gt;I have the same thing here that I have to do.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks,&lt;/P&gt;&lt;P&gt;Caroline,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Jul 2012 10:40:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/converting-xml-string-to-internal-table/m-p/7705619#M1578479</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-07-11T10:40:21Z</dc:date>
    </item>
    <item>
      <title>Re: Converting XML string to internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/converting-xml-string-to-internal-table/m-p/7705620#M1578480</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use this FM to get into internal table&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="L0S52"&gt;CALL &lt;SPAN class="L0S52"&gt;FUNCTION &lt;/SPAN&gt;&lt;SPAN class="L0S33"&gt;'ECATT_CONV_XSTRING_TO_STRING'&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="L0S52"&gt;EXPORTING&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; im_xstring = zl_attcntx&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="L0S52"&gt;IMPORTING&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ex_string&amp;nbsp; = zl_attcont.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="L0S52"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN class="L0S52"&gt;SPLIT zl_attcont &lt;SPAN class="L0S52"&gt;AT &lt;/SPAN&gt;cl_abap_char_utilities=&amp;gt;newline &lt;SPAN class="L0S52"&gt;INTO &lt;/SPAN&gt;&lt;SPAN class="L0S52"&gt;TABLE &lt;/SPAN&gt;zit_legacy.&lt;/SPAN&gt;&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Jul 2012 13:13:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/converting-xml-string-to-internal-table/m-p/7705620#M1578480</guid>
      <dc:creator>NAeda</dc:creator>
      <dc:date>2012-07-13T13:13:31Z</dc:date>
    </item>
  </channel>
</rss>

