cancel
Showing results for 
Search instead for 
Did you mean: 

parse one element of XML data to be another XML data

Former Member
0 Kudos

Hi,experts:

I meet a urgent problem.

It's a PROXY<=>XI<=>SOAP scenario with Qos:BE.

The SOAP receiver returns a XML data base on follow structure:

<?xml version="1.0" encoding="UTF-8" ?>

<ns0:GetCigaXYDataForJAVAResponse xmlns:ns0="http://localhost/CigaTransService/GetCigaXYDataForJAVA/SU">

<GetCigaXYDataForJAVAResult type=""> <NewDataSet>test</NewDataSet> </GetCigaXYDataForJAVAResult>

</ns0:GetCigaXYDataForJAVAResponse>

Attention pls,<NewDataSet>test</NewDataSet> is the value of element "GetCigaXYDataForJAVAResult".It means a xml data is nested in a xml element.OMG.How can i parse a element value to another xml data!

I want to put the value "test" to a xml element named "NewDataSet"

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Using a Java mapping would be the simplest solution. If the response is just a simple XML tag then you can directly use some string functions and achieve the desired results easily.

Regards,

Jaishankar

Answers (2)

Answers (2)

Former Member
0 Kudos

Check the links for xml parsing:

/people/bhavesh.kantilal/blog/2006/11/20/webservice-calls-from-a-user-defined-function

/people/alessandro.guarneri/blog/2006/03/27/sap-xi-lookup-api-the-killer

Reward points if helpful

Regards,

Soumya

Former Member
0 Kudos

because i am new in JAVA and XSLT,i used ABAP MAPPING to solve this problem.

Thanks and regards

Yu Ming

Points are rewarded

Former Member
0 Kudos

Hi,experts:

Finally,i use an abap mapping to solve it.Following is the abap code in XI:

METHOD IF_MAPPING~EXECUTE.

DATA: lr_conv_ci TYPE REF TO CL_RPE_CONVERT .

DATA LS_SOURCE TYPE STRING.

CREATE OBJECT LR_CONV_CI.

CALL METHOD lr_conv_ci->XSTRING_TO_STRING

EXPORTING

INPUT = SOURCE

IMPORTING

OUTPUT = LS_SOURCE.

REPLACE ALL OCCURRENCES OF '& lt;' IN LS_SOURCE WITH '《'.

REPLACE ALL OCCURRENCES OF '& quot;' IN LS_SOURCE WITH 'u2018'.

REPLACE ALL OCCURRENCES OF '& gt;' IN LS_SOURCE WITH '》'.

REPLACE ALL OCCURRENCES OF 'GetCigaXYDataForJAVAResult' IN LS_SOURCE WITH 'GetCigaXYDataResult'.

CALL METHOD lr_conv_ci->STRING_TO_XSTRING

EXPORTING

INPUT = LS_SOURCE

IMPORTING

OUTPUT = RESULT.

ENDMETHOD.

regards

yu ming

Former Member
0 Kudos

Hello,

I think you have to do mapping in IR to convert the given XML to another XML (this is for making the inner XML data not to be parsed )

Check if this weblog is of any help to you - /people/michal.krawczyk2/blog/2005/11/01/xi-xml-node-into-a-string-with-graphical-mapping

***************Reward points,if found useful

Former Member
0 Kudos

I will try to create a XSLT mapping in ABAP to solve this issue.

If it works well, i will reward the points!

regards

yu ming