Application Development 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 xml file

Former Member
0 Kudos
112

Hello,

first of all I don't know much about xml, but I want to extract data from an xml file at a given path.

E.g.

<Human>

<Employee>

<Name>John Doe</Name>

<Phone>+32486448800</Phone>

</Employee>

<Employee>

...

</Employee>

</Human>

So, the user enters the path '/Human/Eployee/Name/' in an input field, the value 'John Doe' in an other input field

and for example ./phone in an other input field. I have to extract the phone number, how would this best be done? I managed to get my file in a if_ixml_document. I've been looking for a method to obtain all '/Human/Eployee/Name/'-nodes, but until now, I haven't found such a thing. Does it exist or do I have to create a complex filter? Thanks.

2 REPLIES 2

Former Member
0 Kudos
74

Hi,

Try this

Function module: SCMS_STRING_TO_FTEXT.It moves XML data into itab.

Reward points if helpful

Message was edited by: amit teja

Former Member
0 Kudos
74

Well, I made quite a strange workaround.

I loaded the xml in a ixml_document and I put the search path in a table.

I made a filter who searched for the last node in the path, so in the above example that would be 'Name'. If a name node was found, I checked if it was the right one, by looping through the table and comparing it with the node->get_parent method.

I think there must be better ways, but this works and that's all I need atm.