Bonjour tout le monde,

Je rencontre un probleme en essayant de parser mon document xml pour le transformer en xhtml. Je pr�cise que je suis d�butant en ajax.

Je recois en fait une reponse SOAP 1.2 de mon server qui contient du code xml que je veux int�grer dans ma page web.

Code XML recu
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
16
17
18
19
20
21
22
23
24
25
26
27
 
<?xml version='1.0' encoding='UTF-8'?>
<SOAP-ENV:Envelope 
   xmlns:SOAP-ENV='http://www.w3.org/2003/05/soap-envelope'
   xmlns:xsd='http://www.w3.org/2001/XMLSchema'
   xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
 <SOAP-ENV:Body>
<SearchObsbyObsvResponse>
<Obs xmlns:xsi="http://www.w3c.org/2001/XMLSchema-Instance">
	<specie>Golden Eagle</specie>
	<observer>test</observer>
	<lat>51.708973</lat>
	<long>-1.0468351</long>
	<datetime>Tue Nov 02 15:20:21 GMT 2004</datetime>
	<numberseen>20</numberseen>
</Obs>
<Obs xmlns:xsi="http://www.w3c.org/2001/XMLSchema-Instance">
	<specie>Barnacle Goose</specie>
	<observer>test</observer>
	<lat>51.651276</lat>
	<long>-1.0312163</long>
	<datetime>Mon Oct 01 08:07:33 BST 2001</datetime>
	<numberseen>18</numberseen>
</Obs>
</SearchObsbyObsvResponse> 
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
J'aimerai transformer ce code par l'interm�diaire du javascript en:

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
16
17
 
<ul>
<li>Golden Eagle</li>
<li>test</li>
<li>51.708973</li>
<li>-1.0468351</li>
<li>Tue Nov 02 15:20:21 GMT 2004</li>
<li>20</li>
</ul>
<ul>
<li>Barnacle Goose</li>
<li>test</li>
<li>51.651276</li>
<li>-1.0312163</li>
<li>Mon Oct 01 08:07:33 BST 2001</li>
<li>18</li>
</ul>
Je recois donc le body de ma reponse soap 1.2 et pour le parser j'utilise ce code javascript

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
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
 
function onReadyStateChanged() {
  if (xmlhttp.readyState == 4) {
    if (xmlhttp.status==200) { // http return code 200 - OK
		var xmlDoc = xmlhttp.responseXML.documentElement;
 
		var ObsList = xmlDoc.getElementsByTagName("Obs");
 
		alert(ObsList.length);
 
		if (ObsList.length != 0) {
 
			var f = document.createDocumentFragment();
 
			for(i = 0; i<ObsList.length; i++) {
				var e = document.createElement("ul");
				var node = ObsList.item(i);
				while(node.hasChildNodes()){
					var li = document.createElement("li");
					li.appendChild(node.firstChild.nodeValue);
					e.appendChild(li);
					node = node.nextSibling;
				}
				f.appendChild(e);
			}
			document.getElementById("divContent").appendChild(f);
		}
	}
  }
}
Mais e est null lorsque je le rajoute � mon DocumentFragment.

Quelqu'un pourrait-il m'expliquer pourquoi ??

Merci d'avance

Romain