Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-16216] Android: XML APIs are returning new proxies every time

GitHub Issuen/a
TypeBug
PriorityLow
StatusReopened
ResolutionUnresolved
Affected Version/sRelease 3.2.0
Fix Version/sn/a
ComponentsAndroid
Labelsandroid
ReporterShameer Jan
AssigneeUnknown
Created2013-07-25T15:36:26.000+0000
Updated2018-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

FileDateSize
console.txt2013-08-02T06:25:48.000+000036582
nodes.xml2013-07-29T10:26:59.000+0000622

Comments

  1. Daniel Sefton 2013-07-25

    Hi Shameer, Please change the test case to be runnable - e.g. the cData variable isn't defined. Thanks.
  2. Daniel Sefton 2013-07-26

    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.
  3. Shameer Jan 2013-07-29

    The Issue still occurs.You can reproduce the issue with the updated code (given) using nodes.xml file. Thank you
  4. Daniel Sefton 2013-07-29

    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"?
  5. Shameer Jan 2013-08-02

    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 )
  6. Mostafizur Rahman 2013-09-18

    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
  7. Shameer Jan 2013-09-18

    Hi Mostafizur Rahman, I have already checked xml format and tried with other files, still exist errors.
  8. Ritu Agrawal 2014-01-17

    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.

JSON Source