cancel
Showing results for 
Search instead for 
Did you mean: 

xml string in multiple lines

Former Member
0 Kudos

I have a string variable which holds an xml string.

I need to display it in a textedit control in webdynpro .

How can i split it across multiple lines to view it in text edit.

original string : <?xml version="1.0"?><test><test1>hello</test1></test>

"This is of type "STRING"

desired format :

<?xml version="1.0"?>

<test>

<test1>

hello

</test1>

</test>

any pointers??

Message was edited by:

Priyank Jain

Accepted Solutions (1)

Accepted Solutions (1)

thomas_szcs
Active Contributor
0 Kudos

Hi Priyank,

You can either split it at '<' or '>' or use a regular expression for splitting it.

Best regards,

Thomas

Former Member
0 Kudos

Hi Thomas,

Thanks for the response.

Yes, splitting is ok. I am going to split the string on '>' but the problem is to now introduce a new line character in the string.

Can you please tell which character is to be introduced so that the textedit control interprets it as a new line character and accordingly displays the output in a new line.

regards,

Priyank

thomas_szcs
Active Contributor
0 Kudos

Hi Priyank,

There are two ways:

(a) You can bind the text edit ui element to a context attribute of type string_table. Each row in the internal table corresponds to a new line in the text edit. Since the split statement is able to place the result into an internal table, this might be the way of choice.

(b) As an alternate solution you could use CL_ABAP_CHAR_UTILITIES=>LF. Simply concatenate this constant into your string at the places you would like to have a line break.

Best regards,

Thomas

Answers (1)

Answers (1)

Former Member
0 Kudos

hi

good

go through this link hope this ll help you to solve your problem.

https://www.sdn.sap.com/irj/go/km/docs/library/dotnet/pdk%20for%20.net/developer's%20Guide%20PDK%202.0%20for%20.NET/Reference/SAP.Web.UI.Controls.TextEdit.html

reward point if helpful.

thanks

mrutyun^

Former Member
0 Kudos

Hi Mrutyunjaya,

I am using webdynpro ABAP . .Net solution will not help me .

regards,

Priyank