Thread: [xmljs-users] Atom Feeds and Encoding
Brought to you by:
djoham,
witchhunter
From: Brent J. <blj...@gm...> - 2005-08-23 23:54:20
|
First off, I just started using xmljs and its great. I'm using the W3CDOM version and I've run into a couple problems. 1) I can't get it to parse Atom feeds. It just keeps returning a NAMESPACE_ERR. Anyone run into this and know how I can fix this, or a way to get around it? 2) Encoding! I'm trying to pull an RSS feed thats in french and the accented characters just keep coming back as garbled when I get the node value of the text node containing the french text. Thanks, - Brent |
From: David J. <dj...@ya...> - 2005-08-25 16:17:57
|
Hi Brent! > 1) I can't get it to parse Atom feeds. It just keeps returning a > NAMESPACE_ERR. Anyone run into this and know how I can fix this, or a > way to get around it? I've never tried an Atom feed. Can you post as small an example as possible so we can take a look at it? > > 2) Encoding! I'm trying to pull an RSS feed thats in french and the > accented characters just keep coming back as garbled when I get the > node value of the text node containing the french text. > Make sure the page's locale header specifies the proper encoding. Otherwise, the browser has to guess what it should be and may very well guess wrong. Otherwise, it should work... Best regards, David |
From: Brent J. <blj...@gm...> - 2005-08-25 18:54:51
|
> > 1) I can't get it to parse Atom feeds. It just keeps returning a > > NAMESPACE_ERR. Anyone run into this and know how I can fix this, or a > > way to get around it? >=20 > I've never tried an Atom feed. Can you post as small an example as possib= le so we can take a look > at it? The example the user sent to me (I'm using xmljs for a Konfabulator widget) was a blog entry on blogspot.com: http://trishtunney.blogspot.com/atom.xml > > 2) Encoding! I'm trying to pull an RSS feed thats in french and the > > accented characters just keep coming back as garbled when I get the > > node value of the text node containing the french text. > > > Make sure the page's locale header specifies the proper encoding. Otherwi= se, the browser has to > guess what it should be and may very well guess wrong. Otherwise, it shou= ld work... Hmm, here's the example RSS feed that has french characters: http://www.lapresseaffaires.com/rss/lpa.xml Thanks, - Brent |
From: David J. <dj...@ya...> - 2005-08-25 19:49:29
|
OK, thanks. I'll see if I can take a look at it sometime tonight or over the weekend... David --- Brent Johnson <blj...@gm...> wrote: > > > 1) I can't get it to parse Atom feeds. It just keeps returning a > > > NAMESPACE_ERR. Anyone run into this and know how I can fix this, or a > > > way to get around it? > > > > I've never tried an Atom feed. Can you post as small an example as possible so we can take a > look > > at it? > > The example the user sent to me (I'm using xmljs for a Konfabulator > widget) was a blog entry on blogspot.com: > > http://trishtunney.blogspot.com/atom.xml > > > > 2) Encoding! I'm trying to pull an RSS feed thats in french and the > > > accented characters just keep coming back as garbled when I get the > > > node value of the text node containing the french text. > > > > > Make sure the page's locale header specifies the proper encoding. Otherwise, the browser has > to > > guess what it should be and may very well guess wrong. Otherwise, it should work... > > Hmm, here's the example RSS feed that has french characters: > http://www.lapresseaffaires.com/rss/lpa.xml > > Thanks, > > - Brent > > > ------------------------------------------------------- > SF.Net email is Sponsored by the Better Software Conference & EXPO > September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices > Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA > Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf > _______________________________________________ > xmljs-users mailing list > xml...@li... > https://lists.sourceforge.net/lists/listinfo/xmljs-users > |
From: David J. <dj...@ya...> - 2005-08-29 03:44:17
|
Hi Brent, namespace: something is horked here, but I don't know what it is yet. For the time being, you can probably get past this by turning namespace support off. It doesn't look like atom feeds really use namespaces all that much, so I doubt that will impact your code at all. To turn namespace support off, you set the namespaceAware property of the DOMImplementation node to false - like this: var parser = new DOMImplementation(); parser.namespaceAware = false; That got me past the exception and I was able to parse the XML properly... encoding: XML for script shouldn't have a problem here. I did a check on the rss feed and the server isn't specifying an encoding. Is it possible that Konfabulator is goofing up the string before xmljs gets it? When I load the XML from that data source, Konqueror loses the accents also. However, Firefox does not. Just to make sure xmljs was OK, I stripped the XML from that source down to the bare minimum that had the accented characters. I then fed that XML into xmljs in Firefox and looked at the DOM tree. The accents were still there. At this point, I'm not sure what really to do about the encoding issue. I do have a battered G3 Powerbook that I can use for further debugging, but I've never used Konfabulator and don't really have a lot of time to learn it. Do you have any suggestions? Please let me know if the namespaceAware property gets you going. I'll try to look at the exception in the next couple of days and see if I can get you a real fix... Best regards, David --- Brent Johnson <blj...@gm...> wrote: > > > 1) I can't get it to parse Atom feeds. It just keeps returning a > > > NAMESPACE_ERR. Anyone run into this and know how I can fix this, or a > > > way to get around it? > > > > I've never tried an Atom feed. Can you post as small an example as possible so we can take a > look > > at it? > > The example the user sent to me (I'm using xmljs for a Konfabulator > widget) was a blog entry on blogspot.com: > > http://trishtunney.blogspot.com/atom.xml > > > > 2) Encoding! I'm trying to pull an RSS feed thats in french and the > > > accented characters just keep coming back as garbled when I get the > > > node value of the text node containing the french text. > > > > > Make sure the page's locale header specifies the proper encoding. Otherwise, the browser has > to > > guess what it should be and may very well guess wrong. Otherwise, it should work... > > Hmm, here's the example RSS feed that has french characters: > http://www.lapresseaffaires.com/rss/lpa.xml > > Thanks, > > - Brent > > > ------------------------------------------------------- > SF.Net email is Sponsored by the Better Software Conference & EXPO > September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices > Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA > Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf > _______________________________________________ > xmljs-users mailing list > xml...@li... > https://lists.sourceforge.net/lists/listinfo/xmljs-users > |
From: Brent J. <blj...@gm...> - 2005-08-29 17:08:22
|
> encoding: > XML for script shouldn't have a problem here. I did a check on th= e rss feed and the server isn't > specifying an encoding. Is it possible that Konfabulator is goofing up th= e string before xmljs > gets it? When I load the XML from that data source, Konqueror loses the a= ccents also. However, > Firefox does not. Just to make sure xmljs was OK, I stripped the XML from= that source down to the > bare minimum that had the accented characters. I then fed that XML into x= mljs in Firefox and > looked at the DOM tree. The accents were still there. >=20 > At this point, I'm not sure what really to do about the encoding issue. I= do have a battered G3 > Powerbook that I can use for further debugging, but I've never used Konfa= bulator and don't really > have a lot of time to learn it. Do you have any suggestions? Konfabulator is cross platform and I'm running it on a Windows machine, but I wouldn't take the time to learn it just for this problem. Here's what I did.. I downloaded the XML feed using "wget" (on Linux) which does nothing but pull it from the server and save it as a text file. Here's the first line: <?xml version=3D"1.0" encoding=3D"ISO-8859-1"?> So it's specifying an encoding there. I did notice that Firefox and IE both were translating the text. If I open the the file I downloaded with wget in Notepad it also shows correctly. So pretty much anything I open it with in Windows works. BUT, if I open the file with VIM on a Linux machine, I see garbled characters. So I suspect that most Windows apps are translating the characters correctly before sending it to xmljs, but Konfabulator on the other hand isn't doing any sort of translation even though its the Windows version, which is odd. I don't know that much about encoding, so :)=20 I'll bounce this back to the Konfab forums. > Please let me know if the namespaceAware property gets you going. I'll tr= y to look at the > exception in the next couple of days and see if I can get you a real fix.= .. That works perfectly! A real fix isn't really high priority to me. I could care less about the Atom namespaces. I just wanted to be able to parse it enough so Atom feeds could be displayed in my RSS Reader widget. Thanks for your help! - Brent |