Ver Mensaje Individual
  #4 (permalink)  
Antiguo 22/02/2005, 08:24
Avatar de Muzztein
Muzztein
 
Fecha de Ingreso: agosto-2002
Ubicación: Hangar 18
Mensajes: 1.703
Antigüedad: 22 años, 8 meses
Puntos: 16
Exclamación

checa esto. estudialo. lo deje lo mas claro posible.

Código:
Function recuperaDato(Posicion,TAG)
    Dim DataField
    On Error Resume Next
    Set DataField = Posicion.getElementsByTagName(TAG)
    recuperaDato = DataField.Item(0).firstChild.nodeValue
    If Err.Number <> 0 Then
        recuperaDato = FALSE
    End If
    Err.Clear
    On Error GoTo 0
    Set DataField = Nothing
End Function

sub principal(xml)
	Set XmlDom = Server.CreateObject("MSXML2.DOMDocument")
	XmlDom.loadXml(XML)
	set xRow = XmlDom.getElementsByTagName("registro_usuario")

	for xCount = 0 to xRow.length -1
		Response.Write "Nombre Usuario N°" & xCount & recuperaDato(xRow.item(xCount),"nombre") & "<br>"
		Response.Write "Apellido Usuario N°" & xCount & recuperaDato(xRow.item(xCount),"apellido") & "<br>"
	next

	Set xRow   = nothing			
	Set XmlDom = nothing
end sub


xml	=   "<raiz>"&_	
		"<registro_usuario>" &_
		"<nombre>Alejandro</nombre>" &_
		"<apellido>Salgado</apellido>"&_
		"</registro_usuario>"&_
		"<registro_usuario>"&_
		"<nombre>Luis</nombre>"&_
		"<apellido>Gomez</apellido>"&_
		"</registro_usuario>"&_
		"<registro_usuario>"&_
		"<nombre></nombre>"&_
		"<apellido></apellido>"&_
		"</registro_usuario>"&_
		"</raiz>"

call principal(xml)
esta llegar y ejecutar