Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

getElementsByTagName issue

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\"?>"+
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.

— asked March 9th 2010 by Mark Poston
  • getelementsbytagname
  • xml

2 Answers

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

    — answered March 9th 2010 by Mark Poston
  • 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.

    — answered March 22nd 2010 by Jeff Haynie
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.