回车的XML问题

时间:2011-02-08 21:55:39

标签: xml flash return

HI,

我正在为Flash网站开发一个管理面板。其中一个部分包含大量包含回车符的文本。它看起来像这样:

  John Doe was born in Athens in 1974.
  He studied at the Athens School of Fine Arts and he presented his first solo exhibition in 1996. 

所以从文本区域文本转到mysql,从mysql我生成一个XML文件。 问题是xml文件源看起来像这样:

   John Doe was born in Athens in 1974. 
   He studied at the Athens School of Fine Arts and he presented his first solo exhibition in 1996. 

这种方式在flash中文本在短语之间有一些很大的空格,我不喜欢它。

请告诉我如何生成XML文件:

  John Doe was born in Athens in 1974.
  He studied at the Athens School of Fine Arts and he presented his first solo exhibition in 1996. 

谢谢

2 个答案:

答案 0 :(得分:2)

行终止符在那里 - 那是
(回车符(CR),0x0D)。换行(LF)为0x0A,将表示为


编写XSLT或使用其他方法将XML实体
转换为Flash将识别的换行符。您可能想要考虑哪些行终止符可以作为操作系统之间的行终止约定来接受:

  • * nix(和OS X)就像一个简单的回车(CR:0x0D)。这将在XML中显示为
  • Windows / DOS喜欢复杂。回车/换行对(CR + LF:0x0D0A)是首选。这将在XML中显示为

  • 老式Mac OS喜欢单个CR(0x0A),它将以
格式显示在XML中。

请注意,对于Unix和Windows,独立回车(CR)通常被解释为“返回行首”。其语义可以解释。

答案 1 :(得分:0)

我解决了自己的问题:

$input=preg_replace( '/\r/', ' ', trim($dd) );      

文本将来自mysql \ r \ n而我只需要\ n所以......我只是删除了\ r

谢谢