11

I have a attribute called: description and I want to have the following in it with new lines:

This is the content description section.
Download instruction:
This is the contents on how to download contents.
Hotline support:
This is the hotline for contents.

How do I create a new line for it in xml?

Deduplicator
  • 44,692
  • 7
  • 66
  • 118
sling
  • 699
  • 3
  • 8
  • 10

3 Answers3

20

Basically you want to insert CRLF:

CR code: 
LF code: 


<myelement description="line1&#13;&#10;line2&#13;&#10;line3"/>
Ramesh Soni
  • 15,867
  • 28
  • 93
  • 113
5

If you need it in XML attribute, you'll have to use character entities:

<element attribute="First line&#10;Second line&#10;Third line..." />
Pavel Minaev
  • 99,783
  • 25
  • 219
  • 289
-5

Try it like this:

<description><![CDATA[first line<br />second line<br />]]></description> 

Basically you wrap the content within your tag inside "" for the closing tag, inbetween this tag you can use
to cause a line break. If you want to double space it, use two
like this:

Hope this helps.

David
  • 682
  • 3
  • 11
  • Next time being more specific would be great. My method works perfectly fine withing the description tag. – David Dec 01 '09 at 14:30