[TIMOB-16216] Android: XML APIs are returning new proxies every time
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Low |
Status | Reopened |
Resolution | Unresolved |
Affected Version/s | Release 3.2.0 |
Fix Version/s | n/a |
Components | Android |
Labels | android |
Reporter | Shameer Jan |
Assignee | Unknown |
Created | 2013-07-25T15:36:26.000+0000 |
Updated | 2018-02-28T20:04:20.000+0000 |
Description
It looks like a platform error, XML APIs are returning new proxies every time. It should cache the nodes that are returned.
The following code reproduces the issue with attached file "nodes.xml": you can see an error occurred in:
valueOf(testRun, attr.ownerElement).shouldBe(node);
with error
[INFO][TiAPI ( 319)] error occured , should be: '[object Element]', was: '[object Element]'
var win = Ti.UI.createWindow({
backgroundColor : "#FFF"
});
win.open();
var shouldBe = function(obj,expected) {
if (obj != expected) {
alert("error occured see Ti.API.info")
Ti.API.info( "error occured , should be: '" + expected + "', was: '" + this.obj + "'");
}
else
{
alert("no error");
Ti.API.info("success");
}
};
this.apiXmlAttr = function() {
var file = Ti.Filesystem.getFile(Ti.Filesystem.resourcesDirectory, 'nodes.xml');
var xmltext = file.read().text;
var doc = Ti.XML.parseString(xmltext);
var scriptList = doc.documentElement.getElementsByTagName("script");
var node = doc.getElementsByTagName("node").item(0);
var attr = node.attributes.item(0);
shouldBe(attr.ownerElement,node);
// OCCURS ERROR
};
apiXmlAttr();
Attachments
File | Date | Size |
---|---|---|
console.txt | 2013-08-02T06:25:48.000+0000 | 36582 |
nodes.xml | 2013-07-29T10:26:59.000+0000 | 622 |
Hi Shameer, Please change the test case to be runnable - e.g. the cData variable isn't defined. Thanks.
Did you run it? testSource is undefined now. I changed it to load the local XML file, but I don't see anything being logged. Please provide steps to reproduce. Thanks.
The Issue still occurs.You can reproduce the issue with the updated code (given) using nodes.xml file. Thank you
Please can you explain how this: {quote}XML APIs are returning new proxies every time. It should cache the nodes that are returned.{quote} Is related to the test case you provided, which indicates that Android is simply not returning any informative exceptions. Is the lack of throwing exceptions due to it not "returning new proxies every time"?
I have updated java script code with simplified test case and You can see that the problem exist with valueOf(testRun, attr.ownerElement).shouldBe(node); ie, failed to compare 'attr.ownerElement' with 'node' . [INFO][TiAPI ( 319)] error occured , should be: '[object Element]', was: '[object Element]' (I have already attached console file )
Hello Shameer Jan, Please check your XML format and add more details for testing. Please explain, why you are thinking this is a bug? Thanks
Hi Mostafizur Rahman, I have already checked xml format and tried with other files, still exist errors.
Reopening this ticket and moving it to engineering as I can reproduce this issue on Android platform. It is, at least, a parity issue because provided test case works fine on iOS platform but not on Android platform.