Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Get the particular xml node by node name

avinashd_m
Participant
0 Likes
1,479

Hi All,

I need to find a particular node given it's name.I have created the XML_DOC instance of CL_XML_DOCUMENT ,as below

xml_doc->parse_string( stream = lv_str )



Here lv_str contains xml code.I know by find_node ( ) method we can search a node given it's tag name ,and it always returns first node with the specified tag name, But i need to find the node(say A)  which is nested inside another tag (say A again) directly by giving the attribute values of that node.To Elaborate please consider below xml example code : --



<?xml version="1.0" ?>

<Component Name="SALV_WD_TABLE" ConfId="0910OZSSFXLYZM6624Y9FW96E1FLNLTP" ConfType="08" ConfVar="OWNRNI">

         <Node Name="CONFIGURATION_CONTEXT" SimpleFormat="true">
f          <Node Name="TABLE_SETTINGS">

        - <Item Index="1">

           <DESIGN>01</DESIGN>

           <DISPLAY_TYPE>01</DISPLAY_TYPE>

           <GRID_MODE>00</GRID_MODE>

           <SCROLLABLE_COL_COUNT>1-</SCROLLABLE_COL_COUNT>

           <VISIBLE_ROW_COUNT>10</VISIBLE_ROW_COUNT>

           <DISPLAY_AS>01</DISPLAY_AS>

            </Item>

       </Node>

               .

               .

               .

               .

In the Above code when i search the node with the find_node  ( ) method as below , it gives me the first node with attribute Name  "CONFIGURATION_CONTEXT"(see xml code above), but i want to get the node with attribute Name = "TABLE_SETTINGS".Is there any other method to achieve this? ,Please Help me to get this,
           
l           v_name = 'Node'.
           node = xml_doc->find_node( name = lv_name ).
         

Thanks,

Avinash D M


1 REPLY 1
Read only

Former Member
0 Likes
904

Hi,

You can use method GET_CHILD of class CL_RSDD_CS_XML_READER.

Regards,

Ashish