fuzzydonut
Programmer
Hi, everyone.
I'll probably get kicked for this question but I've got to understand something...
My question has to do with extracting the contents of a tag into a variable. I.e. <mytag>desired value</mytag>
I've seen this done two ways.
Way #1
slideText = newSlideNode.firstChild.nodeValue;
Way #2
foovar = rootNode.childNodes[idx].childNodes[2].childNodes;
The nodeValue seems to make sense. I want a value, it's in a node. Cool! But it doesn't alway work.
And, isn't childNodes[] just a collection, and with that you still have to fish through the collection to get the property you want (like the tag's value)?
Way #3 - They way it should be ;-)
myvalue = rootNode.childNode[idx].nodeValue;
I've got my program working but this "inconsistency" has me reaching for another beer.
Thanks in advance for any answer or insult.
I'll probably get kicked for this question but I've got to understand something...
My question has to do with extracting the contents of a tag into a variable. I.e. <mytag>desired value</mytag>
I've seen this done two ways.
Way #1
slideText = newSlideNode.firstChild.nodeValue;
Way #2
foovar = rootNode.childNodes[idx].childNodes[2].childNodes;
The nodeValue seems to make sense. I want a value, it's in a node. Cool! But it doesn't alway work.
And, isn't childNodes[] just a collection, and with that you still have to fish through the collection to get the property you want (like the tag's value)?
Way #3 - They way it should be ;-)
myvalue = rootNode.childNode[idx].nodeValue;
I've got my program working but this "inconsistency" has me reaching for another beer.
Thanks in advance for any answer or insult.