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: 

XML to Internal Table with CDATA

AJeB
Participant
0 Kudos
1,241

Hello,
Function Module: SMUM_XML_PARSE
I have an XML file and I want to upload it into ITAB, The upload was successful but it is not getting some values of the XML tags with CDATA,

sample XML tag with CDATA
<CompanyName><![CDATA[ABCD INC.]]></CompanyName> = Getting the data is not successful

<Location>Location 1</Location> = Getting the value is successful

How to fix this or What other FM I can use to get the XML value with CDATA ?

1 ACCEPTED SOLUTION

Sandra_Rossi
Active Contributor
1,085

SMUM_XML_PARSE is just a "weakening" wrapper of IXML, so just copy its code and handle nodes of types CDATA (if_ixml_node=>co_node_cdata_section and if_ixml_cdata_section / method GET_VALUE to get directly "ABCD INC.")

5 REPLIES 5

junwu
Active Contributor
0 Kudos
1,085

use xslt......

Sandra_Rossi
Active Contributor
0 Kudos
1,085

As already answered in the forum: IXML, SXML, ST, XSLT, etc.

Sandra_Rossi
Active Contributor
1,086

SMUM_XML_PARSE is just a "weakening" wrapper of IXML, so just copy its code and handle nodes of types CDATA (if_ixml_node=>co_node_cdata_section and if_ixml_cdata_section / method GET_VALUE to get directly "ABCD INC.")

0 Kudos
1,085

Thankyou ,
I coppied the FM and added this "if_ixml_node=>co_node_cdata_section" inside the get_element next to the "when if_ixml_node=>co_node_text" and I got the result I need.


and I also found other solution in this link
https://jjji35.tistory.com/111


1,085

"other solution in this link" which gives in fact code about if_ixml_node=>co_node_cdata_section, method get_value, which doesn't add much to the answer.

To help future visitors, I guess what you did in the copy of subroutine GET_ELEMENT of include LSMUMF01 (used by SMUM_XML_PARSE), is to change this:

    when if_ixml_node=>co_node_text.
to
    when if_ixml_node=>co_node_text
    or if_ixml_node=>co_node_cdata_section.