Source - JSON in CouchDB (relevant data):
{
"_id":"f994892f3fb525d73b3b6b8a59000e1d",
"_rev":"3-c431ee9334e9be038d9c935efcf2f049",
"teiXML":[
{
"teiHeader":[
{
"fileDesc":[
{
"publicationStmt":[
{
"publisher":"University",
"pubPlace":"Someplace",
"idno type=\"callNo\"":"ABC 007",
"date":"2007"
}
],
This is NSDictionary (simplified):
<CCouchDBDocument: 0x5842c0> (id:f994892f3fb525d73b3b6b8a59000e1d rev:4-3fc1a36de622529cd67416c9e5ae88da {
"_id" = f994892f3fb525d73b3b6b8a59000e1d;
"_rev" = "4-3fc1a36de622529cd67416c9e5ae88da";
teiXML = (
{
teiHeader = (
{
fileDesc = (
{
publicationStmt = (
{
date = 2007;
"idno type=\"callNo\"" = "ABC 007";
publisher = "University";
I would like to get the value "publisher", so I tried using valueForKeyPath:
NSLog(@"%@",[doc valueForKeyPath:@"content.teiXML.teiHeader.fileDesc.publicationStmt.publisher"]);
But instead of the value "University" I get this as a conclusion:
1> 2011-05-26 10:10:02.717 MyApp[12770:707] (
(
(
(
"University"
)
)
)
)
This is pretty annoying. I can get the value using a combination of indexAtObject:
NSLog(@"%@",[[[[[doc valueForKeyPath:@"content.teiXML.teiHeader.fileDesc.publicationStmt.publisher"] objectAtIndex:0] objectAtIndex:0] objectAtIndex:0] objectAtIndex:0]);
Is something supposed to be wrong? There are more values ββto retrieve, and I don't want to count how many objectAtIndex repetition objects I need for them to work.
source
share