<?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: Problem with CL_XML_DOCUMENT_BASE-&amp;gt;FIND_NODE method in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-cl-xml-document-base-gt-find-node-method/m-p/12094915#M1972278</link>
    <description>&lt;P&gt;Could you format your two portions of code please? (CODE button) Thanks.&lt;/P&gt;&lt;P&gt;Moreover, is "node1" a child node of the root node of your XML document?&lt;/P&gt;</description>
    <pubDate>Mon, 30 Sep 2019 13:56:24 GMT</pubDate>
    <dc:creator>Sandra_Rossi</dc:creator>
    <dc:date>2019-09-30T13:56:24Z</dc:date>
    <item>
      <title>Problem with CL_XML_DOCUMENT_BASE-&gt;FIND_NODE method</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-cl-xml-document-base-gt-find-node-method/m-p/12094914#M1972277</link>
      <description>&lt;P&gt;Hello Experts,&lt;/P&gt;
  &lt;P&gt;I there any sample program, where system is trying to fetch node value using FIND_NODE method of class CL_XML_DOCUMENT_BASE. Where importing parameter "NAME" is containing path.&lt;/P&gt;
  &lt;P&gt;for example: &lt;/P&gt;
  &lt;P&gt;constant lv_name type string value 'node1/node2/node3/node4'.&lt;/P&gt;
  &lt;P&gt;lo_xml-&amp;gt;find_node( EXPORTING name = lv_name RECEIVING node = DATA(lo_node) ).&lt;/P&gt;
  &lt;P&gt;And there could be a scenario, where node can contains namespace, as below example,&lt;/P&gt;
  &lt;P&gt;constant lv_name type string value 'nd:node1/node2/xl:node3/node4'.&lt;/P&gt;
  &lt;P&gt;lo_xml-&amp;gt;find_node( EXPORTING name = lv_name RECEIVING node = DATA(lo_node) ).&lt;/P&gt;
  &lt;P&gt;Regards,&lt;/P&gt;
  &lt;P&gt;Praveer.&lt;/P&gt;</description>
      <pubDate>Mon, 30 Sep 2019 13:45:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-cl-xml-document-base-gt-find-node-method/m-p/12094914#M1972277</guid>
      <dc:creator>ipravir</dc:creator>
      <dc:date>2019-09-30T13:45:13Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with CL_XML_DOCUMENT_BASE-&gt;FIND_NODE method</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-cl-xml-document-base-gt-find-node-method/m-p/12094915#M1972278</link>
      <description>&lt;P&gt;Could you format your two portions of code please? (CODE button) Thanks.&lt;/P&gt;&lt;P&gt;Moreover, is "node1" a child node of the root node of your XML document?&lt;/P&gt;</description>
      <pubDate>Mon, 30 Sep 2019 13:56:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-cl-xml-document-base-gt-find-node-method/m-p/12094915#M1972278</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2019-09-30T13:56:24Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with CL_XML_DOCUMENT_BASE-&gt;FIND_NODE method</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-cl-xml-document-base-gt-find-node-method/m-p/12094916#M1972279</link>
      <description>&lt;P&gt;Thanks. Note that it's best to edit your question, as "answers" are to be used when you are proposing a solution to the poster's problem (cf SAP explanation below). PS: you may use the native ABAP type XSTRING, avoid edoc_file that nobody knows.&lt;/P&gt;</description>
      <pubDate>Mon, 30 Sep 2019 14:45:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-cl-xml-document-base-gt-find-node-method/m-p/12094916#M1972279</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2019-09-30T14:45:13Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with CL_XML_DOCUMENT_BASE-&gt;FIND_NODE method</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-cl-xml-document-base-gt-find-node-method/m-p/12094917#M1972280</link>
      <description>&lt;P&gt;The method FIND_NODE of CL_XML_DOCUMENT_BASE is not compatible with namespaces.&lt;/P&gt;&lt;P&gt;What you can do is to use the public attribute M_DOCUMENT which is an instance of the IF_IXML_DOCUMENT interface, which provides the method FIND_FROM_PATH_NS.&lt;/P&gt;&lt;P&gt;I recommend to use the path with a leading / to start at the root node.&lt;/P&gt;&lt;P&gt;The following code should work for "familyns.xml":&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA(element) = lo_xml-&amp;gt;m_document-&amp;gt;find_from_path_ns( 
            default_uri = ''
            path        = '/"fm:family"/"fr:father"/son' ).&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;(pay attention to the quotes around the names with a namespace)&lt;/P&gt;&lt;P&gt;Note that, in "fm:family" of the path parameter, "fm" is not the namespace prefix but the namespace URI, i.e. "fm" in "fm:family" corresponds to the &lt;STRONG&gt;right-hand&lt;/STRONG&gt; side of xlmns:fm="fm". Generally, this value is something like "http://..." so we would have something like this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;            path        = '/"http://...fm...:family"/"http://...fr...:father"/son'.&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 30 Sep 2019 14:53:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-cl-xml-document-base-gt-find-node-method/m-p/12094917#M1972280</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2019-09-30T14:53:50Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with CL_XML_DOCUMENT_BASE-&gt;FIND_NODE method</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-cl-xml-document-base-gt-find-node-method/m-p/12094918#M1972281</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Please use below XML format and  code.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;constant: lc_name type string value 'family/father/son/', OR
          lc_name type string value 
	  l_path TYPE pathextern VALUE ''.
DATA: ex_binary       TYPE XSTRING.
OPEN DATASET l_path FOR INPUT IN BINARY MODE  MESSAGE l_mess .
IF sy-subrc EQ 0.
    READ DATASET l_path INTO ex_binary .
    CLOSE DATASET l_path .
    DATA(lo_xml) = NEW cl_xml_document( ).
    lo_xml-&amp;gt;parse_xstring( stream = ex_binary ).
    lo_xml-&amp;gt;find_node( EXPORTING name = lc_name 
                       RECEIVING node = DATA(lo_node) ).
    IF lo_node IS BOUND.
      DATA(lv_value) = lo_node-&amp;gt;get_value( ).
    ENDIF.
ENDIF.&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Please node: if LC_NAME equal to 'son', then logic is working fine and lv_value is returning correct value but my requirement, LC_NAME would be node path as declared.&lt;/P&gt;&lt;P&gt;Find below XML file format with and without namespace.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;family.xml:&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;family&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;father&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;son&amp;gt;Mr. X&amp;lt;/son&amp;gt; &amp;lt;/father&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;/family&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;familyns.xml:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;fm:family xmlns:fm="fm"&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;fr:father xmlns:fr="fr"&amp;gt; &amp;lt;son&amp;gt;Mr. X&amp;lt;/son&amp;gt; &amp;lt;/fr:father&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;/fm:family&amp;gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Praveer&lt;/P&gt;</description>
      <pubDate>Mon, 30 Sep 2019 14:54:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-cl-xml-document-base-gt-find-node-method/m-p/12094918#M1972281</guid>
      <dc:creator>ipravir</dc:creator>
      <dc:date>2019-09-30T14:54:08Z</dc:date>
    </item>
  </channel>
</rss>

