Comunidad de diseño web y desarrollo en internet online

recorer un archivo de texto

Citar            
MensajeEscrito el 27 Oct 2005 09:15 pm
mi codigo es el sigte
fecha_texto=String(benef_mc.paren_txt.text=benef_xml.childNodes[5].firstChild.nodeValue);

y trato de recorerla pero nu pedo :(

Por britboy

81 de clabLevel



Genero:Masculino  

msie
Citar            
MensajeEscrito el 27 Oct 2005 10:10 pm
Hola britboy
que es eso?

fecha_texto=String(benef_mc.paren_txt.text=benef_xml.childNodes[5].firstChild.nodeValue);


para declarar un tipo de dato como fecha_texto ,String se hace asi

fecha_texto:String

ahora debes cargar tu xml en alguna parte , en alguna funcion, lo que te recomiendo es que no trates de hacer todo con una linea de codigo, pues que simplemente no se puede, eso creo yo
mira: asi es como yo suelo cargar mi xml, y pues lo resolvi porque hac unnos dias postie por aqui este mismo codigo



var array:Array;
function LeeXML(cargador, textos) {
text_txt = cargador;
datos = textos;
trace("te instancie");
}
function mostrarDatos() {
text_txt.html = true;
var largo = array.length;
var msg = "";
for (var i = 0; i<largo; i++) {
msg += array[i].name+"\n";
}
text_txt.text = msg;
}

function cargarDatos() {
var owner = this;
array = new Array();
var my_xml = new XML();
my_xml.ignoreWhite = true;
my_xml.load(datos);
my_xml.onLoad = function() {
//trace(this);
var largo = this.firstChild.childNodes.length;
trace(largo);
for (var i = 0; i<largo; i++) {
var obj = new Object();
obj.address = this.firstChild.attributes.ADDRESS;
obj.port = this.firstChild.attributes.PORT;
obj.name=this.firstChild.childNodes[i].attributes.NAME;

//
array.push(obj); //eso es para ir aplilando los datos
trace(obj.name);
}
mostrarDatos();
};
}
System.useCodepage = true;
limon = text_txt;
xml = new LeeXML(limon, "test.xml");
cargarDatos();


trata de adaptar esto para tu xml
espero haber sido de ayuda

Por mmm

26 de clabLevel



 

mozilla
Citar            
MensajeEscrito el 28 Oct 2005 02:43 pm
muxas gracias mmm
la variable la declare asi como tu dices
esa es la variable al cual le asigo el nodo

Por britboy

81 de clabLevel



Genero:Masculino  

msie

 

Cristalab BabyBlue v4 + V4 © 2011 Cristalab
Powered by ClabEngines v4, HTML5, love and ponies.