You need to be logged in to post in the forums. If you do not have an account, please sign up first.
Opera8 xml problem??
Okay I just upgraded from Opera 8 beta 3 to Opera 8 final and now on a certain site I visit I see that I have an xml problem that I cant view it. I never had that problem on another other version of opera or the beta 8 version. I am forced to use I.E. evertime I am on that site. I dont like I.E. at all and that is why I moved to opera. Now can someone tell me how I can either fix this issue or any plug ins I can get that will work around it. I did a search but nothing correct came up. Thank you.Probably your problem can be fixed with some proxy, ie. Proximitron, but I never used one of those so I can't be sure they can do that.
Regards,
samuil
sorry for my english...

Håvard Kvam Moen @ My Opera / Twitter
The problem is with the page code. Here's an example URL -- http://www.myspace.com/stephaniedosen
The code implementing the Flash-based media player is as follows:
<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" WIDTH="450" HEIGHT="345" id="mp3player" ALIGN="" border=0>
<PARAM NAME=movie VALUE=[b]"http://music.myspace.com/index.cfm?fuseaction=music.player&xmlfid=8787151&siteurl=http://music.myspace.com/&Mytoken=20050425133941"[/b]>
<PARAM NAME=quality VALUE=high>
<EMBED src=[b]"http://music.myspace.com/index.cfm?fuseaction=music.player&Mytoken=20050425133941"[/b] quality=high bgcolor=#FFFFFF WIDTH="450" HEIGHT="345" NAME="mp3player" ALIGN="" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED>
</OBJECT>Note that the embed tag has an incorrect file name. If that is fixed to match the file name in the object tag, your media will play just fine.Never argue with an idiot. They drag you down to their level, then beat you with experience. - Dilbert
I also moved this thread to the Open The Web category. Thanks for noticing the problem.
My blog: miscoded
Stupid code from major websites uncovered and criticised
Contribute site fixes! - OTW&TA- all sites must work
Yeh, it works fine like this in Opera. That's all Opera needs to play it, so it's not like it's hard to support Opera.
Then just used the data attribute to load the proper file and set the type attribute to specificy the proper mime type.
However, as already said, the way that the object tag is currently set up on the site, Opera falls back on the embed tag and the embed tag source is not correct. It's different from the src specified for the object tag.
It's all probably done server-side, so if they fix the problem, it should be fixed for all bands.
<object data="" type="" >
<param name="" value="" valuetype="" />
<div>Alternate text</div>
</object>
data: Where you specify the file to load
type: Where you specify the mime type, which determines what plugin is used to load the file.
codebase: Where you specify a base uri to resolve relative paths in the data and clsid attributes.
clsid: Where you can specify a URI that specifes the implementation for the object
param-name: Where you specify the name of the param the file in data="" uses
param-name: Where you specify the value for the paramamter
param-valuetype: Where you specify the type for the paramater, data/ref/object
param-type: Where you specify the mime type of the param (if it's of type ref)
You also have the option of displaying alternate content if the plugin doesn't initialize or the movie can't be loaded.
Because of ActivX, they really abuse what classid an codebase are for.
Anyway, they don't need to make it more Opera compatible. They just need to do it right and it'll work or at least make the embed tag src be the same as the movie param value.
If the IE method of using the object tag is working in Firefox, it's most likey that the devs added some kind of handling to guess what to do.
Of course, if you do it the right way, in IE, it'll work with basic things, but when the movie has to load something else, it doesn't always work, which is why they first make it work in IE and then allow other browses to fallback on the embed tag, which of course will work if the URI is right.
I suppose if Opera sees the classid and recognizes it as flash, it could be made to look for a movie URI in one of the param tags and use that to load, but it embedding already works if you do it right.
Examples of ones that don't work for me in Firefox
http://www.myspace.com/stephaniedosen
http://www.myspace.com/mindshift
http://www.myspace.com/index.cfm?fuseaction=user.viewProfile&friendID=769597&Mytoken=20050427003818
I decided to try them in IE too. It starts the player, but doesn't load the xml file.
Example of flash that works in *my* IE, Firefox and Opera
Now, I've been to myspace not to long ago and everything worked fine, in IE,Firefox and Opera. Not sure
I don't know whether earlier versions of Firefox work on myspace right now, but I'll have to check.
You of course could always forget the embedding and just load the flash directly till they fix it.
Originally posted by bloodycapes
It was kinda odd since I had no problem viewing myspace with B3 of Opera 8. Also those bands work for me in Firefox odd.
It is odd, but I'm not saying they didn't work for you in Firefox and 8 beta 3. I'm just saying for me, they don't now.
Everything use to work O.K. there, so I think they changed something.
Originally posted by Sigup
Why is this in open the web?
IMO, it's here because this is something the webmaster of myspace needs to fix. However, if there is indeed a bug, I'll report it. I myself just haven't been able to determine for sure if it's a bug as it's not working for me in any browser.
To add to that, neeraj_deshmukh already described how it can be fixed and I also showed how easy it was to get it to work in Opera specifically. Plus, hallvors contacted them with the idea that it was a problem with the site.
The website has made a simple coding mistake: the "fallback" content for browsers that do not understand their OBJECT tag is broken. That's why it is an Open The Web-issue. It is in the site's best interest to fix this because it will make their site more cross-browser compatible, and I have told them so.
2) Is it a bug? Should Opera change to handle this code?
IMO maybe: Opera already tries hard to understand the OBJECT even when some information is missing (specifically, the OBJECT tag should always have DATA and TYPE attributes). It is tricky to always get it right, and some "magic" that perhaps made this page work in beta 3 caused other problems and had to be removed. Perhaps it will come back...
My blog: miscoded
Stupid code from major websites uncovered and criticised
Contribute site fixes! - OTW&TA- all sites must work
2. May 2005, 08:07:49 (edited)
If !object.data, try to get the URI to the file from the param["src"].value or the param["movie"].value.
If !object.type, try to get the type from param["src"].type or param["movie"].type. If that doesn't work, and the classid attribute exists, try to use it to determine the type. (There'd be an internal list of known classids and there mimetypes). If that doesn't work, try to use the extension of the determined source to determine the mime type.
If all of that fails, then display alternate content.
Also, if the data attribute and or the type attribute does exist, but the init fails, Opera could try the secondary methods.
No sense in going overboard to handle poor code, but improving handling in general would definitely be nice.
Edit:
Here's a code example (descriptive purposes only) of what I suggest.
bool src_exists = true;
bool using_movie = false;
if ( object.data.empty() ) {
if ( object.hasParam("src") && !object.param["src"].value.empty() ) {
object.data = object.param["src"].value;
} else if (object.hasParam("movie") && !object.param["movie"].value.empty() ) {
object.data = object.param["movie"].value;
using_movie = true;
} else {
src_exists = false;
}
}
bool type_exists = true;
if ( object.type.empty() ) {
if ( object.hasParam("src") && !object.param["src"].type.empty() && !using_movie) {
object.type = object.param["src"].type;
} else if (object.hasParam("movie") && !object.param["movie"].value.empty() && using_movie) {
object.type = object.param["movie"].type;
} else if ( !object.classid.empty() && classid_list.hasEntry(object.classid) ) {
object.type = classid_list.item(object.classid);
} else {
type_exists = false;
}
}
if (src_exists && type_exists) {
object.init();
}
My blog: miscoded
Stupid code from major websites uncovered and criticised
Contribute site fixes! - OTW&TA- all sites must work
3. May 2005, 01:23:43 (edited)

I think we could just do it with user.js and search through the param array for each object. I've something brewing and if it works out, I'll post the user.js.
document.addEventListener("load", function () {
var obj = document.getElementsByTagName("object");
for (var i = 0; i < obj.length; i++) {
var param = obj[i].getElementsByTagName("param");
for (var c = 0; c < param.length; c++) {
if ( (!obj[i].data || !obj[i].type) && (param[c].getAttribute("name").toLowerCase() == "src" || param[c].getAttribute("name").toLowerCase() == "movie") ) {
if (!obj[i].data) {
obj[i].data = param[c].getAttribute("value");
}
if (!obj[i].type) {
obj[i].type = param[c].getAttribute("type");
}
break;
}
}
if (!obj[i].type && obj[i].getAttribute("classid") ) {
var id = obj[i].getAttribute("classid");
if (id == "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000") {
obj[i].type = "application/x-shockwave-flash";
}
}
if (!obj[i].type && obj[i].data.substring( obj[i].data.lastIndexOf(".") , obj[i].data.length) == ".swf") {
obj[i].type = "application/x-shockwave-flash";
}
}
}, false);
If the type attribute is empty or doesn't exist, the code tries to get the type from the type attribute of a movie or src param. If that doesn't work, it tries to get the type via the classid. If that doesn't work, it tries to get the type by the extension in the source URI.
If the data attribute is empty or doesn't exist, the code tries to get the src from a movie or src param.
The code only includes one classid check (for flash), but more could be added.
If someone wants to give an example of how I could have a map of classids and their values, and how I can search that map for a match, that would be cool.
And of course if Andrew wants to clean the code up, I'm all for it.

It looks pretty good to me. I'd change just the one line:
if (!obj[i].type && obj[i].data.substring( obj[i].data.lastIndexOf(".") ).toLowerCase() == ".swf") {(remove unnecessary second substring parameter, add toLowerCase)As for mapping classid to types:
var types = new Object();
types['clsid:[b][/b]D27CDB6E-AE6D-11cf-96B8-444553540000'] = 'application/x-shockwave-flash';
type = types[getAttribute('classid')];
3. May 2005, 20:15:26 (edited)
Here's the basis of what I was thinking:
document.addEventListener("load", function () {
var types = new Object();
types['clsid:d27cdb6e-ae6d-11cf-96b8-444553540000'] = 'application/x-shockwave-flash';
types['clsid:02bf25d5-8c17-4b23-bc80-d3488abddc6b'] = 'video/quicktime';
types['clsid:663c8fef-1ef9-11cf-a3db-080036f12502'] = 'application/x-java-applet';
types['clsid:cfcdaa03-8be4-11cf-b84b-0020afbbccfa'] = 'audio/x-pn-realaudio-plugin';
types['clsid:166b1bca-3f9c-11cf-8075-444553540000'] = 'application/x-director';
types['clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95'] = 'application/x-mplayer2';
var exts = new Object();
exts['.swf'] = 'application/x-shockwave-flash';
exts['.rpm'] = 'audio/x-pn-realaudio-plugin';
exts['.class'] = 'application/x-java-applet';
exts['.mov'] = 'video/quicktime';
exts['.dcr'] = 'application/x-director';
var obj = document.getElementsByTagName("object");
for (var i = 0; i < obj.length; i++) {
var param = obj[i].getElementsByTagName("param");
for (var c = 0; c < param.length; c++) {
if ( (!obj[i].data || !obj[i].type) && (param[c].getAttribute("name").toLowerCase() == "src" || param[c].getAttribute("name").toLowerCase() == "movie") ) {
if (!obj[i].data) {
obj[i].data = param[c].getAttribute("value");
}
if (!obj[i].type) {
obj[i].type = param[c].getAttribute("type");
}
break;
}
}
if (!obj[i].type) {
obj[i].type = types[ obj[i].getAttribute("classid").toLowerCase() ];
}
if (!obj[i].type ) {
obj[i].type = exts[ obj[i].data.substring( obj[i].data.lastIndexOf(".") ).toLowerCase() ];
}
}
}, false);
* For the last two conditionals, I didn't check to make sure the things were not undefined first. JS let's you get away with trying to assign something undefined.
@hallvors
If we can do that with js, it seems that something like that could be done internally as long as you wait till all the child nodes for the object tag are determined or possibly (to be more efficient) only try it if it fails to init.

Use the navigator.mimeTypes collection to map extensions to types (perhaps build the exts array automatically):
mts = navigator.mimeTypes;
for (i = 0; i < mts.length; i++) {
opera.postError(mts[i].suffixes + ':' + mts[i].type);
}(there are two other properties besides "suffixes" and "type": "description" and "enabledPlugin")BTW, the "mov" and "dcr" extensions seem to be missing a ".".
I'll investigate using the mime.types array for the extensions. Thanks.
For the whole exts part, if no type is specified, Opera already tries to use the mime type of the file specified by the server and if that's not correct, Opera tries to determine the action by the extension. (If the now hidden file types setting is at default). So Opera already does a decent job of trying to find the type. However, there are situations where that doesn't work, so the exts part in the user.js might help for situations like that.
// Try to load objects that don't have a data/type attribute set for it
document.addEventListener("load", function () {
var types = new Object();
types['clsid:d27cdb6e-ae6d-11cf-96b8-444553540000'] = 'application/x-shockwave-flash';
types['clsid:02bf25d5-8c17-4b23-bc80-d3488abddc6b'] = 'video/quicktime';
types['clsid:663c8fef-1ef9-11cf-a3db-080036f12502'] = 'application/x-java-applet';
types['clsid:cfcdaa03-8be4-11cf-b84b-0020afbbccfa'] = 'audio/x-pn-realaudio-plugin';
types['clsid:166b1bca-3f9c-11cf-8075-444553540000'] = 'application/x-director';
types['clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95'] = 'application/x-mplayer2';
var mtl = navigator.mimeTypes;
var obj = document.getElementsByTagName("object");
for (var i = 0; i < obj.length; i++) {
var param = obj[i].getElementsByTagName("param");
for (var c = 0; c < param.length; c++) {
// First try to get the source/type from a movie or src param.
if ( (!obj[i].data || !obj[i].type) && (param[c].getAttribute("name").toLowerCase() == "src" || param[c].getAttribute("name").toLowerCase() == "movie") ) {
if (!obj[i].data) {
obj[i].data = param[c].getAttribute("value");
}
if (!obj[i].type) {
obj[i].type = param[c].getAttribute("type");
}
break;
}
}
// If a source has been found, but still no type.
if (obj[i].data && !obj[i].type ) {
// Try to determine type from the classid attribute.
obj[i].type = types[ obj[i].getAttribute("classid").toLowerCase() ];
// If type still not found, try to determine the type from the extension of the source.
if (!obj[i].type ) {
for (var m = 0; m < mtl.length; m++) {
if (mtl[m].suffixes.indexOf( obj[i].data.substring( obj[i].data.lastIndexOf(".") + 1 ).toLowerCase() ) != -1) {
object.type = mtl[m].type;
break;
}
}
}
}
}
}, false);
MySpace music player bookmarklet
Originally posted by neeraj_deshmukh
Note that the embed tag has an incorrect file name. If that is fixed to match the file name in the object tag, your media will play just fine.
I made a bookmarklet to workaround this issue. It opens the MySpace music player in a new window. I suppose it could be modified to simply fix the problem, too.
7. May 2005, 07:16:09 (edited)
Edit: looks like there's a way
Originally posted by Andrew Gregory
@burnout426: That script is looking pretty nice now!
Thanks for the help.
The script could probably be quickly optimized a little like
for (var i = 0; i < obj.length; i++) {
if (obj[i].data && ojb[i].type) {
continue;
}
// rest of code
to skip the assigning of param and skip entering the parm loop etc. if it's not necessary.
Also, using a nodeiterator might be a little faster as opposed to incrementing an index. Using iterators in c++ can be faster, but not sure with Oprea and js.
object.type = mtl[m].type;
That should be obj.type = mtl[m].type;
Opera Software ASA.
The script needs to be a little smarter first. I've encounter some width/height situations when it comes to to tags with embed as a fallback that I need to fix.
My apologies for sounding redundant, however this is a area i'm not familiar with at all. i see where where you can place your JavaScript Files from the tools>preference>advanced>content>javascript options.
what script can be used so that it is fairly universal. what editor to use so can save the script as a .js file. in the tutorial (i attempted to read and understand most of it) it has 4 methods, should all 4 types of scripts be in folder where Opera is to access?
My blog: miscoded
Stupid code from major websites uncovered and criticised
Contribute site fixes! - OTW&TA- all sites must work
Originally posted by trez260
my fault. windows xp pro. is there a particular script that i should use? i have yet to find a script to correct my problem.
The script written by Burnout426 and posted above should work. For your convenience I have attached it (though the .txt extension needs to be changed to .js) and fixed the typo Burnout426 pointed out a few posts before this one..
So, you can just open this file in Opera, use "Save as", put it in your User JS folder and change the extension to .js. (Opera may not allow you to do that from the save as dialog, not sure.)
objectfix.txt
My blog: miscoded
Stupid code from major websites uncovered and criticised
Contribute site fixes! - OTW&TA- all sites must work
I also get the incorrect input file message.
For comparison, purevolume.com works fine in Opera. purevolume.com and myspace.com both use a flash player to play the songs. They both use the same coding methods to embed the flash. The difference is that myspace.com made a mistake and put the wrong URI in the src attribute for the embed tag.
It works in IE because the object tag is setup in a way that only IE understands.
For Firefox, I need to check the source, but it seems the developers added handling to make broken code like myspace.com's work.
For this one, if the object tag doesn't have a width or height, it looks for a width or height param. Case where that helps.
This version doesn't give up trying to find a source after it encounters the first movie/src param. It keeps trying. Before, it would try to use a src/movie param and quit. Now, if the src param didn't work, it'd try the movie param etc.
Also, for this version, I used hasAttribute(), setAttribute() and getAttribute() all the way through.
I better explain my setup for the conditionals in this one:
I check to make sure an object exists before checking to see if it has an attribute. I then check to see if it has the attribute before I actually get the attribute.
For example, I don't like doing something like this:
if (obj[i] && obj[i].hasAttribute("width")) {
// do something
}
Although that works fine, if obj doesn't exist, I shouldn't be checking to see if it has an attribute; even if js allows that or the interpreter translates that to the following, which I like better.
if (obj[i]) {
if (obj[i].hasAttribute("width")) {
// do something
}
}
I'm still testing this one, but so far, it looks like this one is better.
if (expr1 && expr2){if expr1 is false, then the entire expression must be false, and expr2 is ignored. This is in the language definition (called "short circuit boolean evaluation") and can be relied upon. Your first code block is the conventional and safe way of doing that test. Of course, the second code block is also perfectly fine, it just requires more typing.A similar thing happens with the || operator (if the first expression is true, the entire expression must be true, so following expressions are ignored).
I should have worded things a little differently in my explanation as I mixed 2 different issues.
Revision...
I better explain my setup for the conditionals in this one:
This time I added more conditionals. For example, I make sure an object exists before checking to see if it has an attribute. I then check to see if it has the attribute before I actually get the attribute. I could just forget the checks, get the attribute and rely on it being null/undefined if the attribute doesn't exist (like I did in the previous version), but I don't like getting an attribute value if I don't know the attribute exists first. Personal preference / good practice I guess.
In keeping with the same spirit above, for my conditional blocks, I purposely chose not to check for an object and one of its members in the same 'if' statement condition.
For example, I personally don't like doing something like this:
if (obj[i] && obj[i].hasAttribute("width")) {
// do something
}
Although that works fine and is O.K., Focusing on the second expression itself and forgetting about "short circuit boolean evaluation", it could be undefined if obj doesn't exist. Because of that mindset, I *prefer* to do it like this instead.
if (obj[i]) {
if (obj[i].hasAttribute("width")) {
// do something
}
}
I do realize it can be simplified. Just wanted to explain why I did it like I did so I didn't get a swarm of "you know you can simplify those conditions?".
It seems like when the script gets a relative URI from a movie or source param, the relative uri doesn't get resolved when I set it as the value of the data attribute. I therefore have to set the codebase attribute to http://www.macromedia.com *before* I set the data attribute value to the movie or source param value.
Basically, to get that specific page to work with my user js, I'd have to change the one part to this:
if ( !obj[i].hasAttribute("data") ) {
//obj[i].setAttribute("data", param[c].getAttribute("value") );
obj[i].setAttribute("codebase","http://www.macromedia.com");
obj[i].setAttribute("data", param[c].getAttribute("value"));
}
An odd thing happens when I do that though. The objects load, but right-clicking on them shows "movie not loaded" even though they are.
I've used relative uris with the data atribute before and they work, but the uri was coded in the source. It looks like when you use obj.data = "relative uri" or obj.setAttribute("data","relative uri"), the uri doesn't get resolved like it would if it was coded in the source.
Is that a bug? When I insert a relative uri into the data attribute with JS, should Opera resolve it like it would if it encountered the uri in the source code?
Those 2 objects work fine without the user js, but I wanted to point that out.
Edit:
Nevermind.
Like so many other sites, macromedia is misusing the codebase attribute, which messes up the resolving of the data attribute.
Adding obj.removeAttribute("codebase"); before I set the data attribute fixes the problem in this case. That's not a solution though as what if the codebase attribute was really valid? I think I'll have to check the codebase attribute for common values that misuse the attribute and remove the attribute in that case.
For now, try the attached version. I tested this version with the mtv and limpbizkit intros. They worked. The fix still works for myspace.com.
You can also add the following to the top of the js file so it only executes for myspace.com (After all, why fix sites that are not broken
)// ==UserScript== // @include [url]http://www.myspace.com/*[/url] // ==/UserScript==
You can add more include lines too. However, I think there's a bug where only the last include works, but not sure if that still exists. If you encounter that, *for now* just use extra copies of the scirpt with their own include line.
The script is a general script to improve object tag handling. I am thinking about making one specifically for myspace.com, but for now.....
improve_object_tag_handling-fix.zip
But...it doesn't at http://profile.myspace.com/index.cfm?fuseaction=user.viewprofile&friendID=2132176&Mytoken=20050607144430 and http://www.myspace.com/index.cfm?fuseaction=user.viewProfile&friendID=2746475&Mytoken=20050607144430
now...this might be a coincidence, but I notice that the band it does work on is http://profile.myspace.com and the other are just http://myspace.com, don't really know if thats relevant, just something I noticed...once again, any help would be great!! Thanks a bunch...
http://profile.myspace.com
http://www.myspace.com
http://myspace.com
If you are not using the include stuff, then all I can say is that the script works more often at http://www.myspace.com/mindshift when I don't allow cookies for myspace.com.
I assume that profile.myspace.com requires you to login and use cookies, so you probably won't be able to try it there without cookies.
I've contacted myspace.com many, many times showing them their error and how to fix it, but they won't respond. Opera has contacted them and as far as I know, they have not responded to them either.
I was just going to suggest that you forget about myspace.com and use purevolume.com, but the player at purevolume.com seems to not work sometimes (unless you use always use the user js or open the player in a new window).
Showing topic replies 1 - 50 of 59.