Copy link to clipboard
Copied
Hello,
I have a question about XML path. I'm able to get an informations from xml file (specific numbers), however I'm not able to make a mathematic operation with it. I can trace it as a number, but when I want +/- or */ flash is complaining about that it's not a number.
VydraPrize = xml.firstChild.childNodes[0].childNodes[dayCount].childNodes[0];
* VydraPrize my variable defined as number before
**dayCount my variable
Should I understand that this is not number but some kind of object, or path?
Thanks for help
WZ
Ok I solved it, there should be actually
xml.firstChild.childNodes[0].childNodes[dayCount].childNodes[0].text() + .nodeValue then it's appearing as number.
Thank you very much anyway for inspirating looking for problem in right way : )
WZ
Copy link to clipboard
Copied
xml data is normally in String form. Try forcing it to be a Number and see if that helps...
VydraPrize = Number(xml.firstChild.childNodes[0].childNodes[dayCount].childNodes[0]);
Also, you might try tracing the follow to see what you are dealing with. I am not an xml expert at all, but I know that my dealings with it in the past usually havve me looking for the text() of a node, not the node itself, as in...
xml.firstChild.childNodes[0].childNodes[dayCount].childNodes[0].text()
Copy link to clipboard
Copied
Hmm I tried to force it but it's stil NaN.
Ye well when I'll try to trace : xml.firstChild.childNodes[0].childNodes[dayCount].childNodes[0].text() it will return me undefined. Is it a problem of my XML file?
Copy link to clipboard
Copied
Ok I solved it, there should be actually
xml.firstChild.childNodes[0].childNodes[dayCount].childNodes[0].text() + .nodeValue then it's appearing as number.
Thank you very much anyway for inspirating looking for problem in right way : )
WZ
Copy link to clipboard
Copied
You're welcome
Find more inspiration, events, and resources on the new Adobe Community
Explore Now