Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Como faz?
eu aprendi a manipular o xml pelo flash. no JS é quase a mesma coisa, só estou tendo alguns problema:
Alguem sabe?
function criaXML(){ if(window.XMLHttpRequest){ var xml=new XMLHttpRequest(); } else if(window.ActiveXObject){ var xml=new ActiveXObject("Msxml2.DOMDocument.3.0"); } // Criando XML //Objetivo: //<cadastro><user nome="jose" pass="teste" /></cadastro> try{cadastro=xml.createElement("cadastro");}catch(e){alert("aki1");} try{user=xml.createElement("user");}catch(e){alert("aki2");} try{user.setAttribute("nome","jose");}catch(e){alert("aki3");} try{user.setAttribute("pass","teste");}catch(e){alert("aki4");} try{cadastro.appendChild(user);}catch(e){alert("aki5");} try{xml.appendChild(cadastro);}catch(e){alert("aki6");} // Como fazer o mesmo XML acima usando string? ex: <teste>123</teste> return xml;}function exibeXML(xml){ return xml.toString(); // Não vai pegar, vai dar erro, como faz?}doc=criaXML();document.write(exibeXML(doc));Carregando comentários...