PDA

View Full Version : [STALE-754] 3.1.1 - XmlStore bug w/ attribute-based ID



cstansbury
19 Mar 2010, 12:23 PM
Ext version: 3.1.1
Browsers tested: Firefox 3.6, Safari 4.0.5

When attempting to add a new Record to a (restful) XmlStore, I get an error when parsing the response if the id of the record is based on an _attribute_ of the XML record. However, if I convert the id to be an _element_ of the XML record, it works.

For example, the response following will fail:



this.reader = new Ext.data.XmlReader({
record:"node",
id:"@id"
}, etc.);

Http Response (status=200) XML: <node id="XXX"></node>
Whereas the following will succeed:



this.reader = new Ext.data.XmlReader({
record:"node",
id:"id"
}, etc.);

Http Response (status=200) XML: <node><id>XXX</id></node>
The error appears to be in the code that's sniffing the response trying to "duck type" it.

Workaround is to change the XML response to one that's friendlier to ExtJS, but long term is to make sure that the duck-typing code is fixed (which is hopefully done during the overhaul of the data package mentioned here: http://www.extjs.com/forum/showthread.php?p=448314#post448314. (http://www.extjs.com/forum/showthread.php?p=448314#post448314)

Note: It must be mentioned that the XmlReader operates fine with an id="@id" during a load operation, but only fails when operating on the response of an "Add" operation.

evant
24 Mar 2010, 11:08 PM
Can you post a short test case that demonstrates the issue?

evant
19 May 2010, 7:58 AM
Since there's been no extra info, going to mark this as stale. Please create a new thread if you have a test case.

Condor
19 May 2010, 10:46 PM
An XMLReader is designed to read multiple records from an XML document, so it only supports reading records from within the root node and not the root node itself.

Your server should be returning:

<nodes><node id="XXX"></node></nodes>