Application Development and Automation 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: 
Read only

Question to CL_XML_DOCUMENT: CREATE_WITH_DATA

Former Member
0 Likes
817

Hi colleagues,

i use CL_XML_DOCUMENT: CREATE_WITH_DATA to create a XML file.

This works fine, but there is one thing that I would like to change:

The created XML has the following structure:

<?xml version="1.0" ?>

- <DATA>

- <item>

<KEY>ABC</KEY>

<VALUE>00</VALUE>

</item>

Is it somehow possible to change the structure to the following?:

<DATA>

<Item KEY="ABC" VALUE="00" />

I can read a file that had a strucuture like the structure I would like to

have with CL_XML_DOCUMENT->IMPORT_FROM_FILE , so it should be a valid

represantion of a XML.

Thanks for any responses.

Best Regards

Joachim

2 REPLIES 2
Read only

Former Member
0 Likes
630

OK, I found the error:

CRETE_WITH_DATA does only build elements. What I need is elements with attribute.

I am now building the XML by looping over my internal tabel and building the elements and setting the attributes.

Read only

0 Likes
630

you can also use the approach explained in this thread for setting element attributes.