[TIMOB-4709] Android: XML document.getElementsByTagNameNS seems not to work
| GitHub Issue | n/a |
|---|---|
| Type | Bug |
| Priority | Low |
| Status | Closed |
| Resolution | Fixed |
| Resolution Date | 2011-07-27T15:25:36.000+0000 |
| Affected Version/s | Release 1.8.0 |
| Fix Version/s | Sprint 2011-30, Release 1.8.0 |
| Components | Android |
| Labels | parity |
| Reporter | Bill Dawson |
| Assignee | Bill Dawson |
| Created | 2011-07-18T13:22:09.000+0000 |
| Updated | 2011-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.
Review and test.
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