Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

How to create XML document?

Hallo everyone,

I have a question on creating XML document.

For example,

I want to convert a string 'ABC' to XML format

<A>

<B>

<C>

</C>

</B>

</A>

I know the class IF_IXML_NODE,IF_IXML_DOCUMENT, but I am not sure how to deal with them.

I did like this:

node TYPE REF TO IF_IXML_NODE.

docu TYPE REF TO IF_IXML_DOCUMENT.

docu->create_element( 'A' ).

docu->create_element( '/A' ).

docu->create_element( 'B' ).

docu->create_element( '/B' ).

docu->create_element( 'C' ).

docu->create_element( '/C' ).

node1->set_name( 'A' ).

node2->set_name( 'B' ).

node1->append_child( node2 ).

node3->set_name( 'C' ).

node2->append_child( node3 ).

But I am not sure if this way is correct?

It would be very nice when anynoe of you give some advise!

Thanks in advance!

Regards,

Liying

Tags:
Not what you were looking for? View more on this topic or Ask a question