The new forums will be named Coin Return (based on the most recent vote)! You can check on the status and timeline of the transition to the new forums here.
The Guiding Principles and New Rules document is now in effect.
I want to extract all the AttributeObjs and parse the value of their Name and Value tags. I've started with something like this:
var AttributeList = doc.getElementsByTagName('AttributeObj');
print(AttributeList.length); //3
for (int i = 0; i < AttributeList.Length; i++
{
var Name = AttributeList[i].getElementsByTagName('Name').item(0).firstChild.data;
var Value = AttributeList[i].getElementsByTagName('Value').item(0).firstChild.data;
//Do a bunch of stuff with Name and Value
}
However my diagnostic logging shows that Name and Value are always blank. Does anyone know what I'm doing wrong?
Too lazy to open VS atm, but I believe you should be using double quotes for the tag names.
var Name = AttributeList[i].getElementsByTagName("Name").item(0).firstChild.data;
e:
For further info (and i'm not super literate in javascript so this may not be 100% for you, but);
' is typically used to specify characters, while " is for strings.
Too lazy to open VS atm, but I believe you should be using double quotes for the tag names.
var Name = AttributeList[i].getElementsByTagName("Name").item(0).firstChild.data;
e:
For further info (and i'm not super literate in javascript so this may not be 100% for you, but);
' is typically used to specify characters, while " is for strings.
Javascript actually doesn't care, though JSON cares a lot.
Posts
e:
For further info (and i'm not super literate in javascript so this may not be 100% for you, but);
' is typically used to specify characters, while " is for strings.
the for loop should be javascript doesn't know what an int is, length needs to be lower case and you need the end parenthesis.
jsfiddle
Javascript actually doesn't care, though JSON cares a lot.