AnsweredAssumed Answered

XML parsing using Javascript

Question asked by valfontanette on May 23, 2014
Hi,

I am having trouble to get this working.
It seems my conversion to string doesn't work.
I need to read a xml file, get some tags and create spaces in my structure.
I am doing some tests. Like this:

//code
var doc = document.content; //my document uploaded
var doc_str = new String(doc);

var nfeProc = new XML("<nfeProc><teste>35</teste></nfeProc>");
//var nfeProc = new XML(doc_str.substring(0, doc_str.length));

var str_imp = nfeProc.teste ;


var logFile = space.childByNamePath("log.txt");
if (logFile == null)
{
logFile = space.createFile("log.txt");
}
logFile.content = "";

logFile.content =str_imp;
logFile.save();


//end code

When I create a XML file in my javascript I can manipulate the tags and it works ok. But when I try to do the same with my imported xml file it doesn't work. I compared types but they are not the same.
Can you help me?

Thanks for your attention

Outcomes