<?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 Re: XML Question - Parse out node in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/xml-question-parse-out-node/m-p/1291402#M155462</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Rich: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sometimes you just miss the obvious. I was starting down the road you provided when your email came in.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks, it was the ticket. Points awarded.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 07 Jun 2006 20:47:53 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-06-07T20:47:53Z</dc:date>
    <item>
      <title>XML Question - Parse out node</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/xml-question-parse-out-node/m-p/1291400#M155460</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;My program processes an xml data stored in CRM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The program extracts the XML data as a string. I need to be able to access the data contained within a particular node.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The node &amp;lt;result&amp;gt; contains my data. I need to extract these values to do subsequent data table lookups.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any assistance in gaining access to the result node values is appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;An example of the file is shown below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
&amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt;
&amp;lt;survey xmlns:abapsurvey="http://www.sap.com/abapsurvey" xmlns:bee="http://www.sap.com/survey/bee" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:htmlb="http://www.sap.com/survey/htmlb" xmlns:out="http://www.w3.org/1999/XSL/Output" xmlns:svy="http://www.sap.com/survey/svy" xmlns:tmp="http://www.sap.com/survey/tmp" xmlns:values="http://www.w3.org/1999/XSL/TransformValues" xmlns:wff="http://www.mysap.com/wff/2001"&amp;gt;
  &amp;lt;ratingfactor&amp;gt;
    &amp;lt;id_5067ea774ce37c4a998c56c296ef383e&amp;gt;0 &amp;lt;/id_5067ea774ce37c4a998c56c296ef383e&amp;gt;
    &amp;lt;q1&amp;gt;1 &amp;lt;/q1&amp;gt;
    &amp;lt;id_77cdd93138447b4b993442c2918b8bdb&amp;gt;0 &amp;lt;/id_77cdd93138447b4b993442c2918b8bdb&amp;gt;
    &amp;lt;id_37721faa404c814d9bc265b4f19887f0&amp;gt;0 &amp;lt;/id_37721faa404c814d9bc265b4f19887f0&amp;gt;
    &amp;lt;id_00ec9ccaf7f98542995c5b97261c90d1&amp;gt;0 &amp;lt;/id_00ec9ccaf7f98542995c5b97261c90d1&amp;gt;
    &amp;lt;id_74592f01f5cc2440a87fedda3754db8e&amp;gt;0 &amp;lt;/id_74592f01f5cc2440a87fedda3754db8e&amp;gt;
  &amp;lt;/ratingfactor&amp;gt;
  &amp;lt;result&amp;gt;
    &amp;lt;id_5067ea774ce37c4a998c56c296ef383e&amp;gt;
      &amp;lt;id_3887d603f663d644a03b8212f3af24e7&amp;gt;id_eb6cae9b1688f84babeaae6c2aa53796&amp;lt;/id_3887d603f663d644a03b8212f3af24e7&amp;gt;
    &amp;lt;/id_5067ea774ce37c4a998c56c296ef383e&amp;gt;
    &amp;lt;q1&amp;gt;
      &amp;lt;a1&amp;gt;id_1f84102b913e3344a38cc166a9933452&amp;lt;/a1&amp;gt;
    &amp;lt;/q1&amp;gt;
    &amp;lt;id_77cdd93138447b4b993442c2918b8bdb&amp;gt;
      &amp;lt;id_275bf37ff1a68f4c88aaf7d4fa6cd4dc&amp;gt;id_a655b90477634640955428143e4a6f66&amp;lt;/id_275bf37ff1a68f4c88aaf7d4fa6cd4dc&amp;gt;
    &amp;lt;/id_77cdd93138447b4b993442c2918b8bdb&amp;gt;
    &amp;lt;id_37721faa404c814d9bc265b4f19887f0&amp;gt;
      &amp;lt;id_4915c8ad1dcf2740ac545d3ffd2a0af6&amp;gt;id_65d7c9277da37648b6600de52e2a095e&amp;lt;/id_4915c8ad1dcf2740ac545d3ffd2a0af6&amp;gt;
    &amp;lt;/id_37721faa404c814d9bc265b4f19887f0&amp;gt;
    &amp;lt;id_00ec9ccaf7f98542995c5b97261c90d1&amp;gt;
      &amp;lt;id_2ef55b647e558a4eba40e8f78d15818d&amp;gt;id_46aabd5305894649b9d28f15c0e439b7&amp;lt;/id_2ef55b647e558a4eba40e8f78d15818d&amp;gt;
    &amp;lt;/id_00ec9ccaf7f98542995c5b97261c90d1&amp;gt;
    &amp;lt;id_74592f01f5cc2440a87fedda3754db8e&amp;gt;
      &amp;lt;id_6182ead1dd8fe74abe9feccb316a86d3&amp;gt;This is my additional info for the customer.
    &amp;lt;/id_74592f01f5cc2440a87fedda3754db8e&amp;gt;
  &amp;lt;/result&amp;gt;
&amp;lt;/survey&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Jun 2006 20:06:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/xml-question-parse-out-node/m-p/1291400#M155460</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-07T20:06:02Z</dc:date>
    </item>
    <item>
      <title>Re: XML Question - Parse out node</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/xml-question-parse-out-node/m-p/1291401#M155461</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I hope I understood you correctly.  This program finds the begining of &amp;lt;result&amp;gt; and the end of &amp;lt;/result&amp;gt; and shows whats in the middle.  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

report zrich_0001 line-size 500.

data: result_start type i.
data: result_end   type i.
data: offset type i.
data: xml_string type string.

xml_string = '&amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt;&amp;lt;result&amp;gt;' &amp;amp;
             '&amp;lt;id_5067ea774ce37c4a998c56c296ef383e&amp;gt;' &amp;amp;
             '&amp;lt;id_6182ead1dd8fe74abe9feccb316a86d3&amp;gt;' &amp;amp;
             'This is my additional info for the customer.' &amp;amp;
             '&amp;lt;/id_74592f01f5cc2440a87fedda3754db8e&amp;gt; ' &amp;amp;
             '&amp;lt;/result&amp;gt;&amp;lt;/survey&amp;gt;'.

search xml_string for '&amp;lt;result&amp;gt;'.
if sy-subrc  = 0.
  result_start = sy-fdpos.
endif.

search xml_string for '&amp;lt;/result&amp;gt;'.
if sy-subrc  = 0.
  result_end = sy-fdpos.
endif.

* the plus nine accounts for the "&amp;lt;/result&amp;gt;"
offset = ( result_end - result_start ) + 9.

write:/ xml_string+result_start(offset).

check sy-subrc  = 0.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rich Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Jun 2006 20:18:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/xml-question-parse-out-node/m-p/1291401#M155461</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2006-06-07T20:18:03Z</dc:date>
    </item>
    <item>
      <title>Re: XML Question - Parse out node</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/xml-question-parse-out-node/m-p/1291402#M155462</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Rich: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sometimes you just miss the obvious. I was starting down the road you provided when your email came in.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks, it was the ticket. Points awarded.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Jun 2006 20:47:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/xml-question-parse-out-node/m-p/1291402#M155462</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-07T20:47:53Z</dc:date>
    </item>
  </channel>
</rss>

