Comunidad de diseño web y desarrollo en internet online

Problema al cargar XML

Citar            
MensajeEscrito el 31 Ene 2006 02:53 am
Que onda:
Estoy cargando texto de un asp que genera XML, pero no me lo carga, sin embargo, si copio el codigo fuente y creo un archivo .xml y lo cargo, no me da ningun problema, incluso si abro mi pagina asp en mi explorador, no me marca ningun error en mi pagina, mi codigo es asi:

Código :

var j:Number=new Number(0)
var c:Number = new Number(0);
var titulo:Array = new Array();
var nota:Array = new Array();
var notas:XML = new XML();
notas.ignoreWhite = true;
notas.load("../Formas/notasXML.asp")
//notas.load("../XML/notas.xml")
notas.onLoad = function(success) {
   if (success) {
      _root.myTrace_txt.text += "notas: "+this+"\n";
      _root.myTrace_txt.text += j+"\n";
      for (j in notas.firstChild.childNodes) {
         c++;
         titulo[j] = notas.firstChild.childNodes[j].attributes.titulo;
         nota[j] = notas.firstChild.childNodes[j].attributes.nota;
         _root.myTrace_txt.text += c+"\n";
      }
      _root.myTrace_txt.text += j+"\n";
   } else {
      _root.myTrace_txt.text += "ERROR";
   }
};

Por master_of_puppetz

Claber

2483 de clabLevel

7 tutoriales
3 articulos

Genero:Masculino   Premio_Secretos

WebDev (Flex + PHP + JS)

msie
Citar            
MensajeEscrito el 31 Ene 2006 03:04 pm
En vez de poner la ruta relativa:

Código :

notas.load("../Formas/notasXML.asp") 
debes poner la ruta completa del servidor, por ej:

Código :

notas.load("http://www.domain.com/Formas/notasXML.asp")

Por Altrix

156 de clabLevel



 

Cuba, Ciudad de la Habana

firefox
Citar            
MensajeEscrito el 31 Ene 2006 04:59 pm
Gracias por tu respuesta, jalo muy bien, pero todavía me queda la duda, por que cuando llamo a la asp asi:

Código :

notas.load("../Formas/notasXML.asp");

no lo hace, sin embargo, si llamo al xml de misma forma, si me lo carga:

Código :

notas.load("../XML/notas.xml")

Gracias! ^^

Por master_of_puppetz

Claber

2483 de clabLevel

7 tutoriales
3 articulos

Genero:Masculino   Premio_Secretos

WebDev (Flex + PHP + JS)

msie
Citar            
MensajeEscrito el 31 Ene 2006 08:35 pm
La cosa es que de la segunda forma estás llamando a un XML como tal (es decir un archivo XML) y de la primera forma estás llamando a una pag ASP y ésta tiene que ser procesada anteriormente por el servidor, para darte como resultado un XML.

Por Altrix

156 de clabLevel



 

Cuba, Ciudad de la Habana

firefox
Citar            
MensajeEscrito el 03 Feb 2006 05:22 pm
Vuelvo a abrir este tema del problema con el XML, ahora, no se que pasa, mando llamar a un xml pero me dice que hay un error de servidor, y si abro la asp que genera el xml, jala sin ningun problema, aqui les dejo los detalles, haber si alguien me puede orientar :crap:

1ro. la pagina que genera el xml es:
http://www.fmc.org.mx/vueltasonora/Formas/generaNota.asp?id=1
En esta pagina no hay ningun problema, asp me genera perfectamente el xml

2do. Mi pelicula de flash que carga el xml, pueden entrar a: http://www.fmc.org.mx/vueltasonora/ luego dan click en noticias y cuando se cargue la primer noticia, dan click en 'Más...', ahi es donde tendría que aparecer la nota generada por la pagina del primer punto.

3ro. el codigo: es muy sencillo el codigo que uso:

Código :

stop();
var myStyle:TextField.StyleSheet = new TextField.StyleSheet();
myStyle.load("CSS/noticias.css");
nota_txt.styleSheet = myStyle;
nota_txt.multiline = true;
nota_txt.wordWrap = true;
nota_txt.html = true;
nota_txt.htmlText = "<b>Cargando...</b>";
var story:XML = new XML();
story.sendAndLoad(ruta+"Formas/generaNota.asp? id="+notas.firstChild.childNodes[Index].attributes.rsId, story);//mando llamar mi asp
story.ignoreWhite = true;
story.onLoad = function(exito) {
   if (exito) {
      nota_txt.htmlText = story;
   } else {
      _root.container.myTrace_txt.text += "Index: "+Index;
      nota_txt.htmlText = "<b>¡Error!</b>";
   }
};
story.onHTTPStatus = function(httpStatus:Number) {
   this.httpStatus = httpStatus;
   if (httpStatus<100) {
      this.httpStatusType = "flashError";
   } else if (httpStatus<200) {
      this.httpStatusType = "informational";
   } else if (httpStatus<300) {
      this.httpStatusType = "successful";
   } else if (httpStatus<400) {
      this.httpStatusType = "redirection";
   } else if (httpStatus<500) {
      this.httpStatusType = "clientError";
   } else if (httpStatus<600) {
      this.httpStatusType = "serverError";
   }
};
story.onData = function(src:String) {
   _root.container.myTrace_txt.text += src+"\n";
   _root.container.myTrace_txt.text += ">> "+this.httpStatusType+": "+this.httpStatus+"\n";
   if (src != undefined) {
      this.parseXML(src);
      this.loaded = true;
      this.onLoad(true);
   } else {
      this.onLoad(false);
   }
};

Espero alguien me pueda ayudar, gracias :oops:

Por master_of_puppetz

Claber

2483 de clabLevel

7 tutoriales
3 articulos

Genero:Masculino   Premio_Secretos

WebDev (Flex + PHP + JS)

msie
Citar            
MensajeEscrito el 03 Feb 2006 06:43 pm
He probado tu código y me pincha muy bien.... :wink:, no sé pq te da error.

Por Altrix

156 de clabLevel



 

Cuba, Ciudad de la Habana

firefox

 

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