cancel
Showing results for 
Search instead for 
Did you mean: 

ABAP XML Document generation

Former Member
0 Kudos

Hi All,

I am using DOM Api for generating an xml document in Abap.

I am facing problems while generating a CDATA section in my xml file.Can anyone please provide me a sample code for generating a CDATA section using the IF_XML_DOCUMENT interface in ABAP.

Thanks,

Yomesh

Accepted Solutions (1)

Accepted Solutions (1)

athavanraja
Active Contributor
0 Kudos

are you sure that the interface is IF_XML_DOCUMENT , i dont see it in my WAS 6.40 system

Regards

Raja

Former Member
0 Kudos

HI raja,

The interface is actually IF_IXML.

Created an instance of cl_ixml class.

I have initialized as below

  • initialize iXML

type-pools: ixml.

class cl_ixml definition load.

data irc type i.

  • create main factory

data: ixmlfactory type ref to if_ixml.

ixmlfactory = cl_ixml=>create( ).

      • create stream factory

data: streamfactory type ref to if_ixml_stream_factory.

streamfactory = ixmlfactory->create_stream_factory( ).

Any help appreciated.

thanks,

Yomesh

former_member71078
Discoverer
0 Kudos

Have you resolved this problem ? I have a same problem with the CDATA section and I don´t know how to generate it. Could you send me an example code for this.

Thank you in advance,

Answers (2)

Answers (2)

Former Member
0 Kudos

Hello,

you can append a character data node

to an iXML element, like so:

Given:

DATA: lp_cdata type ref to if_ixml_character_data

lp_element type ref to if_ixml_element,

rc type sy-subrc.

rc = lp_element->append_child( new_child = lp_cdata ).

IF rc <> 0.

raise_xml_exception( ).

ENDIF.

Regards,

Marc

Former Member
0 Kudos

Hi Yomesh,

May be this link can help with some pointers.

<a href="/people/r.eijpe/blog/2005/11/21/xml-dom-processing-in-abap-part-ii--convert-an-xml-file-into-an-abap-table-using-sap-dom-approach:///people/r.eijpe/blog/2005/11/21/xml-dom-processing-in-abap-part-ii--convert-an-xml-file-into-an-abap-table-using-sap-dom-approach

Cheers

VJ