Bonjour , je rencontre un problème bizarre. Je dois supprimer certain élement d'un doc xml.
Voici un exemple prêt à tester pour les plus paresseux
Code :
Le problème est que cela marche sous FF mais pas sous IE !
Pouvez-vous m'aider à résoudre ceci?
D'avance grand merci
Voici un exemple prêt à tester pour les plus paresseux

Code :
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Document sans titre</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script type="text/javascript" src="http://jqueryui.com/jquery-1.3.2.js"></script>
<script>
function general_js_StringToXML(text)
{
if (window.ActiveXObject)//IE
{
var doc=new ActiveXObject('Microsoft.XMLDOM');
doc.async='false';
doc.loadXML(text);
}
else
{
var parser=new DOMParser();
var doc=parser.parseFromString(text,'text/xml');
}
return doc;
}
function general_js_XMLToString(objXml)
{
if (window.ActiveXObject)//IE
{
return objXml.xml;
}
else
{
return (new XMLSerializer()).serializeToString(objXml);
}
}
$(document).ready(function() {
var str_glob_xml_pt = "<pt>"+
"<table id='3'>"+
"<pl>"+
"<name>titi</name>"+
"</pl>"+
"</table>"+
"<table id='7'>"+
"<pl id='p1'>"+
"<name>lolo</name>"+
"</pl>"+
"<pl>"+
"<name>toto</name>"+
"</pl>"+
"<pl id='p3'>"+
"<name>titif</name>"+
"</pl>"+
"</table>"+
"</pt>";
glob_xml_pt = general_js_StringToXML(str_glob_xml_pt);
alert(general_js_XMLToString(glob_xml_pt));
$(glob_xml_pt).find("table").each(function(i){
//alert($(this).attr('id'));
if($(this).attr('id') == 7)
$(this).remove();
});
alert(general_js_XMLToString(glob_xml_pt));
});
</script>
</head>
<body>
</body>
</html>
Le problème est que cela marche sous FF mais pas sous IE !
Pouvez-vous m'aider à résoudre ceci?
D'avance grand merci
