Comunidad de diseño web y desarrollo en internet online

CONCATENANDO DOS XML SALE ERROR

Citar            
MensajeEscrito el 10 Oct 2010 01:16 pm
BUENOS DIAS, ESPERO ME PUEDAN AYUDAR TENGO DOS VALORES XML.
CUANDO INTENTO HACER ESTO:
xmlRecursive = xmlRecursive + xml; me da error
inicialmente xmlRecursive tiene un valor entonces lo que tiene xmlRecursive le quiero adicionar los que tiene xml.
desde ya gracias.
1067: Implicit coercion of a value of type XMLList to an unrelated type XML.

Por CLAnonimo

Claber

600 de clabLevel

5 tutoriales
1 articulo

 

Este es un usuario anónimo genérico para las cuentas borradas o perdidas.

msie8
Citar            
MensajeEscrito el 10 Oct 2010 03:29 pm
BUENOS DIAS, ESPERO ME PUEDAN AYUDAR TENGO DOS VALORES XML.
CUANDO INTENTO HACER ESTO:
xmlRecursive = xmlRecursive + xml; me da error
inicialmente xmlRecursive tiene un valor entonces lo que tiene xmlRecursive le quiero adicionar los que tiene xml.
desde ya gracias.
1067: Implicit coercion of a value of type XMLList to an unrelated type XML.
entonces lo que hice para esto fue... declarar un variable tipo string y a esa variable asignarle el varlo del xml.toXMLString(), luego creo una nueva instancia de xml asignandole el string. es decir...

var stXML:String="<apertura>";
stXML= xmlRecursive .toXMLString() + xml.toXMLString();
xmlRecursive = new XML(stXML);
stXML= stXML + "</apertura>";

Por CLAnonimo

Claber

600 de clabLevel

5 tutoriales
1 articulo

 

Este es un usuario anónimo genérico para las cuentas borradas o perdidas.

msie8
Citar            
MensajeEscrito el 10 Oct 2010 07:30 pm
si estas siguiendo una estructura bien formada XML, usa appendChild()

Jonathan

Por maneuver

243 de clabLevel



Genero:Masculino  

Mexico City

firefox
Citar            
MensajeEscrito el 11 Oct 2010 12:36 pm
LEIDY777, el player te lo esta diciéndo correctamente, la concatenación es propia de los elementos XML, no XMLList.

O sea:

Código ActionScript :

var myXML:xml = "<node/>";
var myXML2:xml = "<node2/>";
var myXML3:xml = myXML + myXML2;


El código:

Código ActionScript :

var stXML:String="<apertura>";
stXML= xmlRecursive .toXMLString() + xml.toXMLString();
xmlRecursive = new XML(stXML);
stXML= stXML + "</apertura>"; 


No tiene sentido directamente.

Si quieres podrías:

Código ActionScript :

var stXML:XML = "<apertura/>";
stXML.appendChild(nodo);


Pero no manejes String si quieres XML.

La función toXMLString, lo que hace es pasar valores no válidos en texto a XML. Ejemplo:

Código ActionScript :

<nodo>Hola</nodo>


toString devolvería Hola, toXMLString devolvería el nodo completo en String.

En resumen puedes usar tanto el concatenado (+) o apprendChild pero siempre y cuando sean objetos XML.

Saludos, Hernán . -

Por Hernán

BOFH

6148 de clabLevel

19 tutoriales
23 articulos

Genero:Masculino   REC Desarrollador de GAIA

Marketing & IT

firefox

 

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