Reproduce Step:
1. Simply run the following code in a default project.
var response= '<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">';
response += '<env:Header/><env:Body>';
response += '<ns0:findEmirateLookupsView1Response xmlns:ns0="/uaq/db/si/model/common/types/">';
response += '<ns0:result xmlns:ns1="/uaq/db/si/model/common/" xmlns:ns0="/uaq/db/si/model/common/types/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns1:EmirateLookupsViewSDO">';
response += '<ns1:EmirateId>1</ns1:EmirateId>';
response += '<ns1:EmiratenameEn>Dubai</ns1:EmiratenameEn>';
response += '<ns1:EmiratenameAr>دبي</ns1:EmiratenameAr>';
response += '</ns0:result>';
response += '<ns0:result xmlns:ns1="/uaq/db/si/model/common/" xmlns:ns0="/uaq/db/si/model/common/types/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns1:EmirateLookupsViewSDO">';
response += '<ns1:EmirateId>2</ns1:EmirateId>';
response += '<ns1:EmiratenameEn>Abu Dhabi</ns1:EmiratenameEn>';
response += '<ns1:EmiratenameAr>أبوظبي</ns1:EmiratenameAr>';
response += '</ns0:result>';
response += '<ns0:result xmlns:ns1="/uaq/db/si/model/common/" xmlns:ns0="/uaq/db/si/model/common/types/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns1:EmirateLookupsViewSDO">';
response += '<ns1:EmirateId>3</ns1:EmirateId>';
response += '<ns1:EmiratenameEn>Sharjah</ns1:EmiratenameEn>';
response += '<ns1:EmiratenameAr>الشارقة</ns1:EmiratenameAr>';
response += '</ns0:result>';
response += '<ns0:result xmlns:ns1="/uaq/db/si/model/common/" xmlns:ns0="/uaq/db/si/model/common/types/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns1:EmirateLookupsViewSDO">';
response += '<ns1:EmirateId>4</ns1:EmirateId>';
response += '<ns1:EmiratenameEn>Al Ain</ns1:EmiratenameEn>';
response += '<ns1:EmiratenameAr>العين</ns1:EmiratenameAr>';
response += '</ns0:result>';
response += '<ns0:result xmlns:ns1="/uaq/db/si/model/common/" xmlns:ns0="/uaq/db/si/model/common/types/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns1:EmirateLookupsViewSDO">';
response += '<ns1:EmirateId>5</ns1:EmirateId>';
response += '<ns1:EmiratenameEn>Ras al-Khaimah</ns1:EmiratenameEn>';
response += '<ns1:EmiratenameAr>راس الخيمه</ns1:EmiratenameAr>';
response += '</ns0:result>';
response += '</ns0:findEmirateLookupsView1Response>';
response += '</env:Body></env:Envelope>';
var result = Ti.XML.parseString(response);
Ti.API.info(result);
var rootNode = result.getElementsByTagName("EmiratenameEn");
Ti.API.info('emirates list length==>> ' + rootNode.length);
Expect Result:
The XML tag should be recongise.
Actual Result:
On android, the tag can't be recongised. But on iOS, it works well.
Note:
If using full tag name with namespace (ns1:EmiratenameEn), it will work well.
But this XML is a response from httpClient, the namespace is changing every time.
There's this method, http://docs.appcelerator.com/platform/latest/#!/api/Titanium.XML.Document-method-getElementsByTagNameNS that does search with namespaces. You can use:
In android to get this to work. Full code would be:
[~sliang] If this solves the issue, I'll resolve this ticket.
It works for me, and now waiting for customer's reply. Thanks a lot. [~msamah]
Closing this as invalid.