Flash/XML 断线& 隐藏人物
我遇到了这个问题,当编辑我的 xml 时,下一行上的所有内容都会
<![CDATA[Line one
Line two
Line three
]]>
在 flash 中渲染两条断线,因为
Line One Line Two Line Three
现在我之前研究过这个问题,它与隐藏的断线字符有关,我使用 Flexbuilder 和/或 Aptana 来编辑 xml,但是如何当我想要一条断裂线时,我是否可以避免有两条断裂线?
I got this problem, when edit my xml everything on a next line renders two breaklines
<![CDATA[Line one
Line two
Line three
]]>
Renders in flash as
Line One Line Two Line Three
Now I researched this before and it had something to do with hidden breakline characters, Im using Flexbuilder and or Aptana to edit the xml, but how do I avoid having two breaklines when I want one.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Flash 将
\r
和\n
解释为换行符。 如果您的输入包含 Windows 行结尾 (\r\n
),那么您会在输出中看到一个空行。要解决您的问题,请在输出数据之前使用以下正则表达式将连续出现的两个
\r
和\n
替换为一个。实际上,
\n\r
不太可能发生,但由于我们已经在替换,所以我们也可以修复这些无效的行结尾。Flash interprets both
\r
and\n
as new line characters. If your input contains windows line endings (\r\n
), then you see a blank line in the output.To solve your problem, use the following regex to replace two consecutive occurrences of
\r
and\n
with one before you output your data.Actually it is unlikely that
\n\r
ever occurs, but since we are already replacing, we can fix these invalid line endings as well.也许您插入了错误的行尾字符。 通常您的选择是:cr-lf、cr 和 lf。 第一个在 Windows 上运行良好,第二个在 Mac 上运行良好,第三个在大多数 Unix 版本上运行良好。 尝试将编辑器设置为使用 lf (\n)。
Perhaps you're inserting the wrong end-of-line characters. Usually your choices are: cr-lf, cr, and lf. The first works well on windows, the second on Mac, the third on most flavors of Unix. Try setting your editor to use lf (\n).