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

Remove tag item from xml

Former Member
0 Likes
2,264

Hi there,

Iu2019ve created a program to generate a xml file, using SDIXML_DATA_TO_DOM function. However it seems that is not working correctly because it generates an extra tag, that is called ITEM, whenever there is a table. However, every program example's that use that function, also generates that tag. Is it possible, somehow, remove it?

Many thanks,

Helena

Hi there,

Iu2019ve created a program to generate a xml file, using SDIXML_DATA_TO_DOM function. However it seems that is not working correctly because it generates an extra tag, that is called ITEM, whenever there is a table. However, every program example's that use that function, also generates that tag. Is it possible, somehow, remove it?

Many thanks,

Helena

10 REPLIES 10
Read only

Former Member
Read only

0 Likes
1,694

Hi, Rimpa,

First of all, thank you for your interest

What I have is this:

<DOCID>

<ITEM>

<TYPE>AR</TYPE>

<NUMBER>1236544</NUMBER>

</ITEM>

<ITEM>

<TYPE>BI</TYPE>

<NUMBER>1254666</NUMBER>

</ITEM>

</DOCID>

And what I want is this:

<DOCID>

<TYPE>AR</TYPE>

<NUMBER>1236544</NUMBER>

</DOCID>

<DOCID>

<TYPE>BI</TYPE>

<NUMBER>1254666</NUMBER>

</DOCID>

I have a table DOCID with two fields: TYPE and NUMBER.

How must I define it to present the information as I wish.

My program is totally in ABAP and not in JAVA.

Thank you for your help,

Helena

Read only

0 Likes
1,694

Rimpa:

Small question...Why did you post ActionScript forums when this is an ABAP forum?

Greetings,

Blag.

Read only

0 Likes
1,694

Helena:

Actually I don't think it's wrong...


<DOCID>
<ITEM>
<TYPE>AR</TYPE>
<NUMBER>1236544</NUMBER>
</ITEM>
<ITEM>
<TYPE>BI</TYPE>
<NUMBER>1254666</NUMBER>
</ITEM>
</DOCID>

Here, <ITEM></ITEM> is being used to clearly separate <TYPE> and <NUMBER> by grouping them...<DOCID> is the main parent tag, so you can't have what you want...You should generate separate XML files for each group...Like...


<DOCID>
<TYPE>AR</TYPE>
<NUMBER>1236544</NUMBER>
</DOCID>


<DOCID>
<TYPE>BI</TYPE>
<NUMBER>1254666</NUMBER>
</DOCID>

Greetings,

Blag.

Read only

0 Likes
1,694

Hi, Alvaro,

I understand your point of view, but this xml file is not for our internal use, is to be send out to another enterprise, that does not want that tag.

However, we've already found a solution for our problem: instead of using the SDIXML_DATA_TO_DOM function, we use a xslt transformation.

See the next link:

[http://www.heidoc.net/joomla/content/view/15/31/]

Thank you for your interest,

Helena

Read only

0 Likes
1,694

Thank you for your interest

Not a problem -:) I'm glad you find a solution...BTW...Welcome to SCN! -;)

Greetings,

Blag.

Read only

0 Likes
1,694

Almost forgot...Please don't forget to mark your question as answered.

Greetings,

Blag.

Read only

0 Likes
1,694

Hi Helena,

I have the same problem. Iu2019ve tried to access to the link but itu2019s not work.

Please explain me how you can solved the problem.

Thanks in advance.

Regards.

Rosa.

Read only

Read only

abap11
Explorer
0 Likes
1,694

Here is another solution,

Hex value for string <item> is '3C6974656D3E'

and for string </item> is '3C2F6974656D3E'

with trailing new line hex value is '0A'.

Some changes in this loop

LOOP AT it_xml INTO xml_tab-d.
REPLACE ALL OCCURRENCES OF '3C6974656D3E0A' IN xml_tab-d WITH ' '.
REPLACE ALL OCCURRENCES OF '3C2F6974656D3E0A' IN xml_tab-d WITH ' '.
APPEND xml_tab.
ENDLOOP.

Hope this helps,

Thanks

Sitesh Sawant.