2023 Jul 11 4:06 AM
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 ?
2023 Jul 11 10:06 AM
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.")
2023 Jul 11 5:05 AM
2023 Jul 11 6:00 AM
As already answered in the forum: IXML, SXML, ST, XSLT, etc.
2023 Jul 11 10:06 AM
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.")
2023 Jul 12 4:41 AM
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
2023 Jul 12 6:41 AM
"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.