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?
use <br/> ; or. wrap block in an element such as a div or p which by default causes a line break after the enclosed text, or in an element such as pre which by default typically will preserve whitespace and line breaks; or.
XML does not require a specific form of line break, so you can use whatever is convenient (carriage return, linefeed, or a combination) when creating an XML file. XML parsers will do the right thing largely because they're parsing on tags, not records - so whatever line break you're using is just whitespace to XML.
A simple attribute value, even that of an xsl:param element's name attribute, may contain whitespace and be perfectly well-formed as XML .
For splitting the value, which should be done with a programming language ideally (even if XPath and XSLT do provide functions), white space seems like a natural separator in XML, but CSS uses a semicolon, and another common separator is a comma, though neither is nearly as XML-friendly as white space since the W3C XML ...
Basically you want to insert CRLF:
CR code:
LF code:
<myelement description="line1 line2 line3"/>
If you need it in XML attribute, you'll have to use character entities:
<element attribute="First line Second line Third line..." />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With