getElementsByTagName issue

You must Login before you can answer or comment on any questions.

Hi, I am trying to use the getElementsByTagName method on a nodeList that I have already created. When I do this, the method only seems to work on the immediate child elements of the node I am querying rather than any nested node. Here's my example:

var xmlstr = "<?xml version=\"1.0\" encoding=\"utf-8\"?>"+
"<root><one>**<two>*<three/><three/>*</two>**<two><three/><three/></two></one></root>";
var xml = Ti.XML.parseString(xmlstr);
var oneList = xml.documentElement.getElementsByTagName("one");
var twoList = oneList.item(0).getElementsByTagName("two");
var threeList = oneList.item(0).getElementsByTagName("three");
In this example, the threeList variable will cause an exception, I would expect it to create a node list with 2 items in it. It seems the getElementsByTagName method only works the way I want from the documentElement. Regards Mark

2 Answers

please note the "*" in code were an attempt to highlight what I am querying.

OK - I think I have fixed all of these related to these issues with this ticket.

This fixes will be in tomorrow's 1.1 release.

Your Answer

Think you can help? Login to answer this question!