Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5954101
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T17:55:21+00:00 2026-05-22T17:55:21+00:00

Source is JSON in CouchDB (relevant data): { _id:f994892f3fb525d73b3b6b8a59000e1d, _rev:3-c431ee9334e9be038d9c935efcf2f049, teiXML:[ { teiHeader:[ {

  • 0

Source is 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 the 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’d like to get the value of “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 output:

1> 2011-05-26 10:10:02.717 MyApp[12770:707] (
        (
                (
                        (
                "University"
            )
        )
    )
)

Which is quite annoying. I can get the value with an indexAtObject-combination:

NSLog(@"%@",[[[[[doc valueForKeyPath:@"content.teiXML.teiHeader.fileDesc.publicationStmt.publisher"] objectAtIndex:0] objectAtIndex:0] objectAtIndex:0] objectAtIndex:0]);

Something must be wrong there? There are more values to extract and I don’t want to count how many objectAtIndex-repetitions I need to make it work.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T17:55:22+00:00Added an answer on May 22, 2026 at 5:55 pm

    You are mentioning the “xml” tag, so I suppose that your NSDictionary is being built from some XML data. In this case, one hypothesis that could explain this behavior is that your XML contains repeated keys, like in:

    <values>
      <value>
      ......
      </value>
      <value>
      ......
      </value>
      ...
    </values>
    

    Indeed, repeated values like in the examples are not suitable to be treated through Key-Value Coding and are handled internally as NSArrays. Now, the actual details of why you get so many nested arrays in your reply are difficult for me to figure out, but this could give you a hint at what is happening.

    If this hypothesis does not apply to your case, please share the way you build your NSDictionary.

    EDIT: after looking at your JSON, there is something that looks not obvious to me. Look at this:

    "publicationStmt":[
                    {
                       "publisher":"University",
                       "pubPlace":"Someplace",
                       "idno type=\"callNo\"":"ABC 007",
                       "date":"2007"
                    }
                 ],
    

    what I understand is you have nested arrays: plublicationStmt contains an array ([) which at turns contain another (keyed) array ({)…

    Is this possibly that produce your result?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I use this json data as data source of jquery autocomplete? [{uid:123,UserName:xxx},{uid:124,UserName:yyy}]
I call a remote data source and get back json. After I select an
I'm trying to load and parse json data from an external source into a
How can I create the JSON source expected by the google.visualization.datatable using C#? Obviously
https://search.twitter.com/search.json?q=doug How do I read this like VIEW SOURCE, so that I know what
JSON web site uses very clear notation to describe JSON's syntax: (source: json.org )
I'm currently playing a bit with couchdb. I'm trying to migrate some blog data
I found this diagram in the JSON specification: (source: json.org ) Where does this
I'm using JSON event source in my code. How can I switch 'evenDatasource' on
If i have a source for the .autocomplete() that is JSON, and like this:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.