簡體   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