Ver Mensaje Individual
  #4 (permalink)  
Antiguo 01/12/2005, 20:57
Avatar de u_goldman
u_goldman
Moderador
 
Fecha de Ingreso: enero-2002
Mensajes: 8.031
Antigüedad: 23 años, 3 meses
Puntos: 98
Justo estaba terminando esto, seguro no te costará nada entenderlo, las líneas comentadas de abajo son las que escriben el archivo, nada del otro mundo:

Código:
	Public Function WriteXML()
		Dim FSO
		Dim intCount
		Dim strXml		
		intCount = 50
		ds = GetTopVisited()
		strXml = "<?xml version=""1.0""?>" & vbCrLf		
		if isArray(ds) then
			Dim strName
			Dim strValue
			'strXml = strXml & "<?xml:stylesheet type=""text/xsl"" href=""xmltest.xsl""?>" & vbCrLf
			strXml = strXml & "<record>" & vbCrLf
			Dim arrTopVisited()
			Redim arrTopVisited(intCount,2)
			strIDS = ","
			
			for i = 0 to uBound(ds,2)
				connectbit = 0
				if inStr(1,strIDS,","&ds(0,i)&",") > 0 then
					connectbit = 1
				else
					strIDS = strIDS & ds(0,i) & ","
				end if
				if connectbit = 0 then
					arrTopVisited(y,0) = ds(2,i)
					arrTopVisited(y,1) = ds(1,i)
					arrTopVisited(y,2) = ds(3,i)
					y = y + 1
				end if
				if i+1 = cint(qty) then
					exit for
				end if
			next
			erase ds
			ds = arrTopVisited
			
			for j = 0 to i-1
				strXml = strXml & "<page>" & vbCrLf
					strXml = strXml & "<name>" & Server.HTMLEncode(ds(j,1)) & "</name>" & vbCrlf
					strXml = strXml & "<id>" & Server.HTMLEncode(ds(j,0)) & "</id>" & vbCrlf
					strXml = strXml & "<hits>" & Server.HTMLEncode(ds(j,2)) & "</hits>" & vbCrlf
					strXml = strXml & "<pos>" & j+1 & "</pos>" & vbCrLf
				strXml = strXml & "</page>" & vbCrLf				
			next
			strXml = strXml & "</record>"
		end if
		
		'Set FSO = Server.CreateObject("Scripting.FileSystemObject")
		'Set XmlFile = FSO.CreateTextFile(Application("counter_log_path")&"counter.xml", true)
		'XmlFile.Write(strXml)
		'Set FSO = Nothing
		'Set XmlFile = Nothing
		WriteXML = strXml
	End Function
__________________
"El hombre que ha empezado a vivir seriamente por dentro, empieza a vivir más sencillamente por fuera."
-- Ernest Hemingway