在 XML 中添加新的换行符/换行符 [英] Adding a new line/break tag in XML

查看:139
本文介绍了在 XML 中添加新的换行符/换行符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试向 XML 中的代码添加新行/换行符,但没有成功.

I have been trying to add a new line/break to code within XML and have been unsuccessful.

到目前为止我已经尝试过:

I have tried so far:

<br />
<br> 



这是我正在使用的代码示例.我包含了
"来显示代码中中断的位置.

Here is a sample of the code I am working with. I included "
" to show where the break is located within the code.

<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="dummy.xsl"?>
  <item>
     <summary>Tootsie roll tiramisu macaroon wafer carrot cake.       
               &#xA; Danish topping sugar plum tart bonbon caramels cake.
     </summary>
  </item>

推荐答案

这个问题的解决方案是:

The solution to this question is:

<?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>

通过在 中添加
这允许换行,从而创建一个新行!

by adding the <br /> inside the the <![CDATA]]> this allows the line to break, thus creating a new line!

这篇关于在 XML 中添加新的换行符/换行符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆