Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-4709] Android: XML document.getElementsByTagNameNS seems not to work

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionFixed
Resolution Date2011-07-27T15:25:36.000+0000
Affected Version/sRelease 1.8.0
Fix Version/sSprint 2011-30, Release 1.8.0
ComponentsAndroid
Labelsparity
ReporterBill Dawson
AssigneeBill Dawson
Created2011-07-18T13:22:09.000+0000
Updated2011-08-26T15:08:53.000+0000

Description

Sample XML, put this in a test app's Resources folder:
<?xml version="1.0" encoding="UTF-8"?>
<response xmlns:abc="http://example.com">
    <something>123</something>
    <something>456</something>
    <abc:cake>yummy</abc:cake>
    <abc:cake>very yummy</abc:cake>
    <abc:pie>also yummy</abc:pie>
</response>
Use this app.js
Titanium.UI.setBackgroundColor('#000');
var win = Titanium.UI.createWindow({  
    title:'Test',
    backgroundColor:'#000',
	exitOnClose: true
});
var xml = Ti.Filesystem.getFile("with_ns.xml").read().text;
Ti.API.info("xml: " + xml);
var doc = Ti.XML.parseString(xml);
var elems = doc.getElementsByTagNameNS("http://example.com", "cake");
Ti.API.info("Matching elements: " + elems.length);
win.open();
The log message will say "Matching elements: 0.0". It should be 2.0.

Comments

  1. Don Thorp 2011-07-27

    Review and test.
  2. Natalie Huynh 2011-08-26

    Tested XML Drillbit (test case above covered in Elements section) with: version=1.8.0 timestamp=08/26/11 14:21 githash=0e2031e Android Emulator 2.1 and 3.2

JSON Source