A javascript nugget..

I should say this is only for browsers and environments which support E4X ( so not IE7-8-9)

So you import your xml in and then you want to use E4X to manipulate it but for some reason it just won’t happen. In firefox there is a bug which the following code fix

$(document).ready(function() {
$.ajax({
url: ‘boe_ser.xml’,
success: function(xmlObj){
var xmlString = (new XMLSerializer()).serializeToString(xmlObj);
xmlString = xmlString.replace(/^<\?xml\s+version\s*=\s*(["'])[^\1]+\1[^?]*\?>/, “”);
var xmlData = new XML(xmlString);

},
dataType: ‘xml’
});
});

It would appear that Firefox has an issue with the <?xml tag… ! who knew

This entry was posted in javascript. Bookmark the permalink.