Jump to content

XML check issue (was identical XML file, but is not)


thesoundsmith

Recommended Posts

I have a page that swaps out titles, text and XML playlist files to play music selections.I have it working fine in Chrome and FF, but iOS and IE don't get it. Especially confusing is IE - i have copied the laylist to all lists, so it is always identical. But ONLY the "jazz" list loads and plays fine, the others go into limbo - they appear to have loaded, but not selected anything (as opposed to not loading at all or creating an error msg.) It appears that there is a bug in the XML playlists somewhere, but I cannot check it - all the XML checkers I've tried stop at a link fragment that includes ";cpath=" - It wants me to add a semicolom after cpath, but then ;cpath;=" generates a different error (and the link won't work...) The page is at: http://www.thesoundsmith.com/radio.htm and the playlist I'm using (that works in all cases) is http://www.thesounds...m/xml/radjz.xmlThe main (broken) list is at http:// http://www.thesounds...m/xml/radfull.xml Thanks for any ideas, I'm fresh out. The playlists work fine in FF and Chrome, but there must be an error in the ohter lists - is there a checker that can handle the clause:

<item><media:content url="wavs/esp2/13.Makin'_Whoopee.mp3" /><media:thumbnail url="pix/esp2_360.gif" /><title>Makin' Whoopee</title><description>Especially For You Too</description><link>private/zcart/index.php?main_page=product_info&cPath=71&products_id=297</link></item>

...

Edited by The Soundsmith
Link to comment
Share on other sites

When I do that, the link does not function. This is a series of 242 Zencart page addresses. In the current version of the system, they all work, if I encapsulate anything, or alter the link info in any way it fails. All I am trying to do is find bug in the file(s) I apparently have a typo or missing.malformed element in 1700+ lines of xml, and I guess I need to create a workaround file that will let me use the checker to find the problem. Thanks. I think I know what to do, but if it still fails, I'll be back...

Link to comment
Share on other sites

URL encoding won't work in a URL? This seems to be a classic problem with XML. I know I had trouble using &_n_b_s_p_; in my XSL file and had to change it to &_#_160_; http://www.w3schools...ml_entities.asp For [ampersand] the choices seem to be &_amp_; or &_#_38_; or %_26 or \_u_0026

Edited by davej
Link to comment
Share on other sites

URL encoding won't work in a URL? This seems to be a classic problem with XML. I know I had trouble using &_n_b_s_p_; in my XSL file and had to change it to &_#_160_; http://www.w3schools...ml_entities.asp For [ampersand] the choices seem to be &_amp_; or &_#_38_; or %_26 or \_u_0026
URL encoding is used when you want to send an ampersand as data, for example:example.com?a=5&str=%26 --> a = 5 and str = "&"If you substitute all & for %26 the data that is sent is incorrect:example.com?a=5%26str=%26 --> a = "1&str=&" & is supposed to be interpretted and substituted for & by the XML parser before the data is provided to the program that's reading it so it shouldn't be causing any trouble.
Link to comment
Share on other sites

I have narrowed the options down to one - something wierd in parsing the XML file. The symptoms are currently this: The page works correctly in FF, Chrome and iOS, but not IE. The playlists are all created from the one XML file that loads properly in IE - the rest simply are created by removing items from the list. I tried several things to find the error - first, I copied the file and set all the & and ; chars to just text, so the link is invalid, but the XML checker could scan the files (all I wanted was to validate the <title></title> type matching tags. No errors, all the tags match.I replaced the other XML files with the one properly loading file (radjz.xml) The links on the page all work, the file loads every time, so it's not a typo or miscode on the page. And now., the kicker: I copied the working file to the other playlist XML files, so the files are identical. IE will not open any but the first, and when i tried copying the file to a new name and opening it, IE would not...What am I missing? Again, the page is at http://www.thesoundsmith.com/radio.htmIf you click on The Jazz Joint, it loads and plays, the others do not. (xml/radeasy, radsmooth, radblues, radfull.xml)

Link to comment
Share on other sites

OK, I'm back to this same issue: Internet Explorer... But the issues take forever to catch up. IE now recognizes the indentical XML files under new name, though it tool over 24 hours to do so (I cannot find a "clear cache" command in IE.) So I'm back trying to figure out - not how th\o solve the problem but what the ACTUAL problem is. Some files can be added to the XML list without issue, many other, apparently r\equivalent files cause loading issues. It may be just another 24-hour cache thing, so I've got to play some more to see what is in common.. If you have suggestions how to turn this around faster, I'd love it., but I think I'll have to start a new thread when and if I learn anything useful. Thanks again.

Edited by The Soundsmith
Link to comment
Share on other sites

If you want to disable caching for that file then you can either configure the server to return headers that disable the cache, or you can append a unique or random value to the end of the URL with Javascript. e.g.:

    jwplayer("container").setup({	    flashplayer: "/jwplayer/player.swf",        playlistfile: 'xml/radfull.xml?d=' + Date.now(),	    skin: 'skinz/car2/car2.xml',	   "playlist.position": "bottom",	    "playlist.size": 80,	    shuffle: "true",	    autostart: "true",	    height: 480,	    width: 480 ,	    volume: 40,	    repeat: 'always'    }); } jwplayer('container').load("xml/radjz.xml?d=" + Date.now());

Link to comment
Share on other sites

Interesting approach, thanks. What I have done in the meanwhile is to alter the XML <link> data, replacing the '&'s with the phrase 'DAKa'. The file loads flawlessly, but i can't quite figure out how to roll the replacement back into the command.

function deCod(linkStr){var str=linkStr;return str.replace(/DAKa/g,"&");}

The first command works correctly with a normal (unencoded) link. The second line should decode the link, but I can't figure out the syntax - just a replace, but I'm obviously doing it wrong.

<ul><li><a id="btn1" class="button3" title="Buy this Song" onclick="window.open(jwplayer(container).getPlaylistItem().link);">Buy</a></li> <li><a id="btn7" href="*" class="button3" title="test" onclick="window.open(deCod(jwplayer(container).getPlaylistItem().link));">Decode</a></li></ul>

Thanks for the help. (The page is at http://www.thesoundsmith.com/radio.htm and the "Decode test link is below the red "Close" button, for testing.)

Link to comment
Share on other sites

It's not necessary to use a regular expression like that, you're looking for a specific string to replace. I think you can just do this: return str.replace("DAKa","&"); This would also work: return str.split("DAKa").join("&");

Link to comment
Share on other sites

There are typically two ampersands in a link &cpath and &product, I had already tried your first option and it only catches the first &. The expression str.replace(/DAKa/g,"&")creates the proper string, I just can't get the calling function to see/use the return string, it just appears to do nothing, rather than link to the shopping cart page.

Link to comment
Share on other sites

The code you show above should do it, with the window.open. The way it is now on your site you have the Javascript code in the href. It doesn't execute that code, it uses the code as the filename.

Link to comment
Share on other sites

I have been swapping out pieces of that page for the last hour, you probably saw it during that mess (with no success.) It just does not seem to execute the code. Here is the deCod in situ:

<script type="text/javascript">/* <![CDATA[  */function nuStyle (myStyle) {var theStyle = myStyle ;var curStyle =document.getElementById("container");var nuScript=curStyle.getElementsByTagName("script");function deCod(linkStr){var str=linkStr;return str.replace(/DAKa/g,"&");}

This:

<li><a id="btn1" class="button3" title="Buy this Song" onclick="window.open(jwplayer(container).getPlaylistItem().link);">Buy</a></li>

performs as expected with the unencoded list, it opens a window to the link address. When I wrap the link in the deCod function:

<li><a id="btn7"  class="button3" title="test" onclick="window.open(deCod(jwplayer(container).getPlaylistItem().link));">Decode</

It just - hangs, tra la la, I'm going out for a latte..??? :facepalm: . I have set a break at the var str=linkStr line and it never fires. I tried adding the href="*" so it would DO something, and then tried replacing onclick with href - I'm just throwing stuff at it at this point, I don't get why I cannot get a response from the function. On its own, it returns the proper string.

Link to comment
Share on other sites

If that's actually how you defined the function, then the problem might be that you defined the deCod function inside the nuStyle function, so it would only be available from that scope. Define it as a global function, outside of any other function.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...