[xmljs-users] Escaping " ' " in .getText();
Brought to you by:
djoham,
witchhunter
From: (Berklie) I. <in...@be...> - 2003-11-20 21:44:32
|
Hi there, I'm using XML for SCRIPT in the following manner: var currentCoverArtPath = "/player_status/current_song/song/coverart"; var xmlFetchedCoverArt = xml.selectNode(currentCoverArtPath); var fetchedCoverArt = xmlFetchedCoverArt.getText(); if (fetchedCoverArt == "") { fetchedCoverArt = "Resources/background.png"; } else { theCoverArt.src = "http://192.168.1.100:9000" + fetchedCoverArt; } This works great to display album Cover Art when the string is something like this: <coverart><![CDATA[/music/ %2fVolumes%2fAlexandria%20Project%2fMusic%20Library%2fArtists%2fAdams,%2 0Ryan%2f2001%20Gold%2f01-New%20York,%20New%20York.mp3/cover.jpg]]></ coverart> But if the string has a " ' " in it, like this (with the "B-52's,%20The" or "1979%20The%20B-52's"): <coverart><![CDATA[/music/ %2fVolumes%2fAlexandria%20Project%2fMusic%20Library%2fArtists%2fB- 52's,%20The%2f1979%20The%20B-52's%2f01-Planet%20Claire.mp3/ cover.jpg]]></coverart> It doesn't work. Obviously (well I think anyway), it's because the " ' " is causing the script to think the statement is over. How can I get it to know that the " ' " is okay to have? I guess I'm trying to figure out how to "escape" it? Thanks, BD |