繁体   English   中英

如何解析XML标签中的换行符?

[英]How to parse newlines in XML Tags?

我正在解析RSS feed,因为<description>标记包含这样的\\ n行字符

    <?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
<item>
      <guid>http://www.horseandhound.co.uk/blogs/7619/314307.html</guid>
      <title>Chloe Chubb&#039;s s<title>Chloe Chubb&#039;s showing blog: Horse of the Year Show (HOYS) preparations</title>
      <description>So it is a week before HOYS and I have somehow managed to stay a bit oblivious to it all. It is only when I log onto Facebook and see the many, many statuses talking about it that I realise it’s only just around the corner! Then the butterflies begin.
&lt;br /&gt;
 /&gt;
My pre-HOYS diet was going well until last weekend when me and my best mates headed for a weekend away by the beach. Cue huge amounts of cheese, wine and cake and with the 5 pounds I’d lost, 2 went straight back on.&amp;#8230;</description>
      <url>http://www.horseandhound.co.uk/blogs/7619/314307.html</url>
</item>
</channel>
</rss>

在这里,我能够解析文本直到第一行“ line1 ..中的某些文本”,但是从下一行开始,不会解析其余文本。 我正在使用Dom解析器。请提出解决方法。

您可以使用实体&#10; 代表XML属性中的换行符。
&#13; 可用于表示回车。
Windows样式CRLF可以表示为&#13;&#10;

有关更多详细信息,请参见XML规范

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM