This fixes a bug where attributes of a object would also get added to parent object. #505

Merged
merged 1 commit into from Jan 20, 2012

Projects

None yet

2 participants

@spenrose
Contributor

XML to parse

<exchange_rate type="XML_RATE_TYPE_EBNK_MIDDLE" valid_from="2011-08-03 00:00:00.0">
    <currency name="AUD" quota="1" rate="18.416"/>
    <currency name="HRK" quota="1" rate="3.25017"/>
    <currency name="DKK" quota="1" rate="3.251"/>
</exchange_rate>

BEFORE FIX

<CFBasicHash 0xab93140 [0x520b38]>{type = mutable dict, count = 1,
entries =>
    0 : <CFString 0xabacac0 [0x520b38]>{contents = "exchange_rate"} = <CFBasicHash 0xaba99e0 [0x520b38]>{type = mutable dict, count = 6,
entries =>
    0 : <CFString 0xabc1e40 [0x520b38]>{contents = "currency"} = (
        {
        name = AUD;
        quota = 1;
        rate = "18.416";
    },
        {
        name = HRK;
        quota = 1;
        rate = "3.25017";
    },
        {
        name = DKK;
        quota = 1;
        rate = "3.251";
    }
)
    1 : <CFString 0xaba9940 [0x520b38]>{contents = "name"} = <CFString 0xaba9960 [0x520b38]>{contents = "DKK"}
    2 : <CFString 0xaba9990 [0x520b38]>{contents = "rate"} = <CFString 0xaba99c0 [0x520b38]>{contents = "3.251"}
    3 : <CFString 0xaba9980 [0x520b38]>{contents = "quota"} = <CFString 0xaba99a0 [0x520b38]>{contents = "1"}
    4 : <CFString 0xab93180 [0x520b38]>{contents = "type"} = <CFString 0xab931b0 [0x520b38]>{contents = "XML_RATE_TYPE_EBNK_MIDDLE"}
    5 : <CFString 0xab93190 [0x520b38]>{contents = "valid_from"} = <CFString 0xab93220 [0x520b38]>{contents = "2011-08-03 00:00:00.0"}
}

}

AFTER FIX

<CFBasicHash 0xa689830 [0x520b38]>{type = mutable dict, count = 1,
entries =>
    0 : <CFString 0xa6816a0 [0x520b38]>{contents = "exchange_rate"} = <CFBasicHash 0xa6897c0 [0x520b38]>{type = mutable dict, count = 3,
entries =>
    0 : <CFString 0xa692100 [0x520b38]>{contents = "valid_from"} = <CFString 0xa692190 [0x520b38]>{contents = "2011-08-03 00:00:00.0"}
    1 : <CFString 0xa680860 [0x520b38]>{contents = "currency"} = (
        {
        name = AUD;
        quota = 1;
        rate = "18.416";
    },
        {
        name = HRK;
        quota = 1;
        rate = "3.25017";
    },
        {
        name = DKK;
        quota = 1;
        rate = "3.251";
    }
)
    2 : <CFString 0xa6920f0 [0x520b38]>{contents = "type"} = <CFString 0xa692120 [0x520b38]>{contents = "XML_RATE_TYPE_EBNK_MIDDLE"}
}

}
@spenrose spenrose This fixes a bug where attributes of a object would also get added to…
… parent object.

XML to parse
```
<exchange_rate type="XML_RATE_TYPE_EBNK_MIDDLE" valid_from="2011-08-03 00:00:00.0">
    <currency name="AUD" quota="1" rate="18.416"/>
    <currency name="HRK" quota="1" rate="3.25017"/>
    <currency name="DKK" quota="1" rate="3.251"/>
</exchange_rate>
```

BEFORE FIX
```
<CFBasicHash 0xab93140 [0x520b38]>{type = mutable dict, count = 1,
entries =>
	0 : <CFString 0xabacac0 [0x520b38]>{contents = "exchange_rate"} = <CFBasicHash 0xaba99e0 [0x520b38]>{type = mutable dict, count = 6,
entries =>
	0 : <CFString 0xabc1e40 [0x520b38]>{contents = "currency"} = (
        {
        name = AUD;
        quota = 1;
        rate = "18.416";
    },
        {
        name = HRK;
        quota = 1;
        rate = "3.25017";
    },
        {
        name = DKK;
        quota = 1;
        rate = "3.251";
    }
)
	1 : <CFString 0xaba9940 [0x520b38]>{contents = "name"} = <CFString 0xaba9960 [0x520b38]>{contents = "DKK"}
	2 : <CFString 0xaba9990 [0x520b38]>{contents = "rate"} = <CFString 0xaba99c0 [0x520b38]>{contents = "3.251"}
	3 : <CFString 0xaba9980 [0x520b38]>{contents = "quota"} = <CFString 0xaba99a0 [0x520b38]>{contents = "1"}
	4 : <CFString 0xab93180 [0x520b38]>{contents = "type"} = <CFString 0xab931b0 [0x520b38]>{contents = "XML_RATE_TYPE_EBNK_MIDDLE"}
	5 : <CFString 0xab93190 [0x520b38]>{contents = "valid_from"} = <CFString 0xab93220 [0x520b38]>{contents = "2011-08-03 00:00:00.0"}
}

}
```

AFTER FIX
```
<CFBasicHash 0xa689830 [0x520b38]>{type = mutable dict, count = 1,
entries =>
	0 : <CFString 0xa6816a0 [0x520b38]>{contents = "exchange_rate"} = <CFBasicHash 0xa6897c0 [0x520b38]>{type = mutable dict, count = 3,
entries =>
	0 : <CFString 0xa692100 [0x520b38]>{contents = "valid_from"} = <CFString 0xa692190 [0x520b38]>{contents = "2011-08-03 00:00:00.0"}
	1 : <CFString 0xa680860 [0x520b38]>{contents = "currency"} = (
        {
        name = AUD;
        quota = 1;
        rate = "18.416";
    },
        {
        name = HRK;
        quota = 1;
        rate = "3.25017";
    },
        {
        name = DKK;
        quota = 1;
        rate = "3.251";
    }
)
	2 : <CFString 0xa6920f0 [0x520b38]>{contents = "type"} = <CFString 0xa692120 [0x520b38]>{contents = "XML_RATE_TYPE_EBNK_MIDDLE"}
}

}
```
c6fd924
@jeffarena jeffarena merged commit fa44916 into RestKit:master Jan 20, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment