Fixed.
After try a lot of things, I found out this:
In IE you can't use .find method on a string, neither html, if you are searching for an "non standar HTML tag".
- var ejemplo =
"<result><evento><name>hola</name></evento><evento><name>mundo</name></evento></result>";
- $(ejemplo).find("evento").each(
- function(){
- alert($(this).text());
- });
So, in my example I was searching for "evento". IE doesn't recognize that tag, so the function:
- document.getElementsByTagName("evento");
which I assumed is used to implement .find method, won't return any match under IE (but it does under Firefox, Chrome and every navigator which accomplishes standards).
So the solution to the problem goes by parsing xml string on a xmlDOM object, then this will work fine.
- var text="<result><evento><name>hola</name></evento><evento><name>mundo</name></evento></result>";
- var xmlDoc;
- if (window.DOMParser)
- {
- parser=new DOMParser();
- xmlDoc=parser.parseFromString(text,"text/xml");
- }
- else // Internet Explorer
- {
- xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
- xmlDoc.async="false";
- xmlDoc.loadXML(text);
- }
-
-
- $(xmlDoc).find("evento").each(
- function(index,value){
- alert($(this).find("name").text());
- }
- );
This solution has same behaviour under Firefox than IE.
I hope this could help you. Regards.