PDA

View Full Version : Help with mapping in model



rojad
23 Jan 2015, 4:53 AM
Hi,

I am trying to map id in the following xml to the model file.

XML:
<test id="val1">
<name>4</name>
<shortName>04</shortName>
<description>desc</description>

<passdownInd>true</passdownInd>
</test>

Model:
fields: [
{
name: 'id',
type: 'string',
mapping: 'test[id]'
},
]

When I check the value in the network traffic, I see id value as "". It will be great if anyone can point where the problem is.

Thanks,
Roja.

joel.watson
23 Jan 2015, 1:24 PM
Hi Roja--

How have you configured the reader for your model? Assuming the "test" is your root, you should be able to change the mapping to "@id".

Here's an example (below), I hope it helps!

Thanks
Joel

h1n

rojad
26 Jan 2015, 11:10 PM
Hi Joel,Thank you for the reply. Yes, the problem was in the reader. My application is working as expected now.Thanks,Roja.