View Full Version : parsing nested XML: xml reader

11 Aug 2012, 5:37 PM
I have an Xml response from server like,

<property id=123 name=p1>

<value name=v1 attrb1=12 />
<value name=v3 attrb1=12 />
<value name=v4 attrb1=12 />


<property id=13 name=p2>

<value name=v2 attrb1=12 />



I understand that using 'hasMany' config I can store the xml data into two models (say, Property & Value),only if the value elements are inside a <values> </values> tag. For example,

<property id=123 name=p1>

<value name=v1 attrb1=12 />
<value name=v3 attrb1=12 />
<value name=v4 attrb1=12 />



But, my server response doesn't have this <values> tag and I can't modify the server response. Is there any way I can read my server response using xml reader?? or can i parse my xml response somehow OR modify it on client side before reading ??

Any help is appreciated... Thanks

13 Aug 2012, 7:39 AM
You can define a mapping from XML structure path to model field see:


13 Aug 2012, 8:17 PM
Hi Thanks for replying.. But how can i map multiple records of that model to a specific record ? Could you specify an example.. Thanks again..

11 Jul 2013, 12:34 PM
I am also wondering this.

There doesn't seem to be anyway to get the hasMany association to get all of the <value> elements without having a <values> parent.

Seems like an oversight in the XML reader to me.

2 Sep 2013, 8:54 AM
I have the same problem.

So, if respons xml file format had the some bottom node with same name , I can't get the node value.
If I set the bottom node to record config , I can't get the value.
If I set the next bottom node to record config , I get the only one bottom node value.

Is there the solution?:-/

Example: I can't get the LastNode value with xmlreader.


Thank you.