Skip to Content
author's profile photo Former Member
Former Member

Extracting cdata from xml file ( if_ixml_cdata_section )


We will receive xml files containing product data that I want to upload into the sales text of our materials in JP28.

Using the iXML library with T_FILE_PARSE program as an example I can easily extract most fields but the problem is that one field has paragraphs of text in CData. Using the code bellow I can extract some of the data as a string but it's too short to get everything.

case node->get_type( ).
      when if_ixml_node=>co_node_cdata_section.
        break grainneq.

        text = node->get_value( ).
        write: / 'CDATA:'.
        write at indent text color col_group inverse.

Looking in the library

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Aug 18, 2011 at 05:03 AM

    This is the XML file tag I'm concerned with

    <longDescription><![CDATA[This chapter contains blah blah blah goes on for a few paragraphs




    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      My bad, text was in fact receiving the full string (I thought it was truncating).

      So I've just added a function module to split the string into lines that the CREATE_TEXT fm can handle.

      Both responses were helpful so I've awarded points....although the question was probably confusing to you as the data was there along:)

      Thanks for the quick response in any case.

      when if_ixml_node=>co_node_cdata_section.
              text = node->get_value( ).
              call function 'SWA_STRING_SPLIT'
                  input_string           = text
                  max_component_length   = 132
                  string_components      = swastrtab.

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.