Node list working, but what about terminal values?
Posted: Tue Sep 25, 2007 5:42 pm
I have some code that works to parse messages. First I look into the data retrieved by the data element to get the individual updates:
Next, I look into the updateMessages to find indvidual subelements of message:
to get the text in the "recent" element inside the i-th message element. (I retreive some other elements as well, edited out for clarity.)
However, this code fails to work on the plumVoice platform. I've tried pulling out individual elements to at least see the nodeType but can't even manage that:
I realize that the very last log statement probably won't print anything sensible. However, the first on ought to. Is getElementByTag() failing to work on a node taken from a nodeList, even though the node is an element?
Code: Select all
updateMessages = messageInfo.documentElement.getElementsByTagName("message")
Code: Select all
updateMessages.item(i).getElementsByTagName("recent").item(0).textContent
However, this code fails to work on the plumVoice platform. I've tried pulling out individual elements to at least see the nodeType but can't even manage that:
Code: Select all
<script>
<![CDATA[
// another debug hunt
debugThat = new Array()
for (var i=0 ; i < updateMessages.length; i++ ) {
debugThat[i] = new Object()
debugThat[i].recent = updateMessages.item(i).getElementsByTagName("recent").item(0)
}
]]>
</script>
<!-- DEBUG printouts -->
<log expr="logdelim + 'elements first child, entries ' + debugThat.length"/>
<foreach array="debugThat" item="index">
<log expr="logdelim + 'item type:' + index.nodeType" />
<log expr="logdelim + 'item recent: ' + index.recent"/>
</foreach>