Re: [xmljs-users] Escaping " ' " in .getText();
Brought to you by:
djoham,
witchhunter
From: David J. <dj...@ya...> - 2003-11-20 22:32:29
|
Hi! I'm not sure I'm seeing what you are describing. I just tried a quick derivation of the tagpath example application with some CDATA and an apostrophy and it seemed to work. Please see the attached gzipped example. You can load it by replacing domTagPathExample.html in: xml_for_script-3.0/sampleApplications/classicDom/domSampleApplicationTagPath with the domTagPathExample.html I'm including with this message. When I load that example and hit the button, it comes back with what I would expect, which is the full string. Do you see something different? When you say it doesn't work, what exactly do you mean? Does the string get cut off or truncated at the position of the apostrophy when you call getText()? Or does the tagpath not work at all? Would it be possible to put together a quick recreation and send that to me. If you can, I can probably figure out what's going on pretty quick and get you going... Thanks David --- Info <in...@be...> wrote: > 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 > > > > ------------------------------------------------------- > This SF.net email is sponsored by: SF.net Giveback Program. > Does SourceForge.net help you be more productive? Does it > help you create better code? SHARE THE LOVE, and help us help > YOU! Click Here: http://sourceforge.net/donate/ > _______________________________________________ > xmljs-users mailing list > xml...@li... > https://lists.sourceforge.net/lists/listinfo/xmljs-users __________________________________ Do you Yahoo!? Free Pop-Up Blocker - Get it now http://companion.yahoo.com/ |