Firefox DOMParser problem

Posted by Michael on Stack Overflow See other posts from Stack Overflow or by Michael
Published on 2010-05-08T04:42:37Z Indexed on 2010/05/08 4:48 UTC
Read the original article Hit count: 156

Filed under:
|
|
|

For some reason DOMParser is adding some additional #text elements for each newline \n for this url

http://rt.com/Root.rss

...as well as many other RSS I've tried. I checked cnn/bbc feeds, they don't have newlines and dom parser handling them nicely. So I have to add the following before parsing it

var xmlText = htmlText.replace(/\n[ ]*/g, "");
var xmlDoc = parser.parseFromString(xmlText, "text/xml");

Server is returning text/xml.

var channel = xmlDoc.documentElement.childNodes[0];

this returning \n without my code above and channel with correction.

© Stack Overflow or respective owner

Related posts about dom

Related posts about parser