Bonjour,

je dois g�n�rer via un script javascript, un fichier xml de ce format :

Code : S�lectionner tout - Visualiser dans une fen�tre � part
1
2
3
4
5
6
7
<?xml version="1.0" encoding="UTF-8"?>
<DemandeRemboursement xmlns="test/dossierEntrant">
    <ENTETE>
        <CODECAISSE>01371</CODECAISSE>
    </ENTETE>
    <pli rangPli="1">
...
Pour faire, j'ai cod� ceci :

Code : S�lectionner tout - Visualiser dans une fen�tre � part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
     //Instanciation Document XML en mémoire
      iXml = new ActiveXObject('Microsoft.XMLDOM');
      iXml.async = false;
 
      szXmlFileName = szMonFic+".xml";        
 
      // Initalize XML file
      nodePli = iXml.createProcessingInstruction('xml', "version='1.0' encoding='UTF-8'");
      iXml.appendChild(nodePli);
 
      root = iXml.appendChild( iXml.createElement('DemandeRemboursement'));
      attr = iXml.createAttribute('xmlns');
      attr.value = ('tmp/dossierEntrant');
      root.setAttributeNode(attr);
...
Malheureusement, j'obtiens en sortie :

Code : S�lectionner tout - Visualiser dans une fen�tre � part
1
2
3
4
5
6
7
<?xml version="1.0" encoding="UTF-8"?>
<DemandeRemboursement xmlns="test/dossierEntrant">
    <ENTETE xmlns="">
        <CODECAISSE>01371</CODECAISSE>
    </ENTETE>
    <pli xmlns="" rangPli="1">
...
J'ai un peu chercher sur les forum et j'ai trouv� cette discussion (http://www.developpez.net/forums/sho...xmlns%3D%22%22) qui, en gros, explique que pour �viter la propagation du xmlns � vide dans les balises filles, je dois utiliser un createNode plut�t que createElement.
J'ai donc modifi� mon script ainsi :

Code : S�lectionner tout - Visualiser dans une fen�tre � part
1
2
3
4
5
6
7
8
9
10
11
12
     //Instanciation Document XML en mémoire
      iXml = new ActiveXObject('Microsoft.XMLDOM');
      iXml.async = false;
 
      szXmlFileName = szMonFic+".xml";        
 
      // Initalize XML file
      nodePli = iXml.createProcessingInstruction('xml', "version='1.0' encoding='UTF-8'");
      iXml.appendChild(nodePli);
 
      root = iXml.appendChild(iXml.createNode(1, 'DemandeRemboursement', 'tmp/dossierEntrant'));
...
mais j'obtiens malheureusement le m�me r�sultat...

Est ce que quelqu'un voit o� est mon erreur?
Merci d'avance.