Line Break in XML formatting ?

Line Break in XML formatting ?

Asked on January 9, 2019 in XML.
Add Comment


  • 7 Answer(s)

    XML formatting:

    • For a line break use \n and to insert a tab \t.
    • Also use other XML tags like: <b> for bold text, <i> for italics, and <u> for underlined text for basic formatting.
    Answered on January 9, 2019.
    Add Comment

         Use CDATA with \n if refering to res strings,

    <string name="about">
        <![CDATA[
    Author: Sergio Abreu\n
    http://sites.sitesbr.net
      ]]>
    </string>
    
    Answered on January 9, 2019.
    Add Comment

         Instead of \n, add <br>. Then can add text to TexView:

    articleTextView.setText(Html.fromHtml(textForTextView));
    
    Answered on January 9, 2019.
    Add Comment

    when editing a String in XML I need to add line breaks. And I wanted to ask what is the RIGHT form when programming for android? Because <br> works but ECLIPSE marks the area as problematic. If I check out suggestions Eclipse tells me that I shall add a end tag </br> – IF I add that the line break dissapears…

    So the one works but is marked as problematic, the other works not but Eclipse tells me its ok..

     

    Answered on February 25, 2019.
    Add Comment
    <string name="about">
        <![CDATA[
     Author: Sergio Abreu\n
     http://sites.sitesbr.net
      ]]>        
    </string>
    Answered on February 25, 2019.
    Add Comment
    <?xml version="1.0" encoding="utf-8"?>
    <?xml-stylesheet type="text/xsl" href="dummy.xsl"?>
      <item>
         <summary>Tootsie roll tiramisu macaroon wafer carrot cake.       
                   
     Danish topping sugar plum tart bonbon caramels cake.
         </summary>
      </item>
    Answered on February 25, 2019.
    Add Comment
    <?xml version="1.0" encoding="utf-8"?>
    <?xml-stylesheet type="text/xsl" href="dummy.xsl"?>
      <item>
         <summary>
            <![CDATA[Tootsie roll tiramisu macaroon wafer carrot cake. <br />      
                     Danish topping sugar plum tart bonbon caramels cake.]]>
         </summary>
      </item>
    Answered on February 25, 2019.
    Add Comment


  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.