Fa lo stesso scherzo, ti posto di seguito il codice preciso preciso:
codice:
<%
url=Server.MapPath("test.xml")
Set objXML = Server.CreateObject("msxml2.DOMDocument.3.0")
objXML.async = false
objXML.setProperty "ServerHTTPRequest", True
objXML.validateOnParse = false
objXML.preserveWhiteSpace = false
blnLoaded = objXML.Load(url)
set objNodeList = objXML.getElementsByTagName("annuncio")
For Each objNode In objNodeList
For Each objNode2 In objNode.childNodes
Select Case objNode2.nodeName
Case "tipologia"
tipologia = objNode2.firstChild.nodevalue
Case "foto1"
foto1 = objNode2.firstChild.nodevalue
End Select
Next
response.write "<table>"&vbcrlf
response.write "<tr><td>Dati : "&tipologia&"</td></tr>"&vbcrlf
response.write "<tr><td>Foto : "&foto1&"</td></tr>"&vbcrlf
response.write "</table>"&vbcrlf
next
%>
XML:
codice:
<?xml version="1.0" encoding="UTF-16"?>
<ArrayOfannuncio xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<annuncio>
<tipologia>BOX 1</tipologia>
</annuncio>
<annuncio>
<tipologia>BOX 2</tipologia>
<foto1>2</foto1>
</annuncio>
<annuncio>
<tipologia>BOX 3</tipologia>
</annuncio>
<annuncio>
<tipologia>BOX 4</tipologia>
</annuncio>
<annuncio>
<tipologia>BOX 5</tipologia>
<foto1>5</foto1>
</annuncio>
<annuncio>
<tipologia>BOX 6</tipologia>
</annuncio>
</ArrayOfannuncio>
Il risultato è:
codice:
Dati : BOX 1
Foto :
Dati : BOX 2
Foto : 2
Dati : BOX 3
Foto : 2
Dati : BOX 4
Foto : 2
Dati : BOX 5
Foto : 5
Dati : BOX 6
Foto : 5
Che ovviamente non è giusto