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 8523005
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T07:17:16+00:00 2026-06-11T07:17:16+00:00

what i’m trying to achieve is the following. I’ve got a MySQL database and

  • 0

what i’m trying to achieve is the following. I’ve got a MySQL database and using SimpleXML in a PHP script to convert there entries to XML. So i’ve got a ‘id’, ‘department’, ‘name’, ‘tel’ and an ’email’ field. PHP parses it to this output (don’t know if this is the most logical output, but seems legit) (primary unique key ‘id’ has been left out)

<?xml version="1.0" encoding="UTF-8" ?>
<entries>
<entry>
<department>DeptA</department>
<name>NameA</name>
<tel>0000-111111</tel>
<email>namea@abc.com</email>
</entry>
<entry>
<department>DeptB</department>
<name>NameB1</name>
<tel>0000-2222222</tel>
<email>nameb1@abc.com</email>
</entry>
<entry>
<department>DebtB</department>
<name>NameB2</name>
<tel>0000-2222223</tel>
<email>nameb2@abc.com</email>
</entry>

more entry

</entries>

So i have three Views in Xcode. First View (MasterViewController) should report the departments as unique values. In above XML DebtA and DebtB. (more in actual XML) and list them in a Table View. Tried do do this with NSSlist *uniqueArray (etc) without success. Then when clicking on a department in MasterViewController you go the DebtViewController which lists all the names of the employees working in that particular department. So for DebtB that should be NameB1 and NameB2. (DebtA only NameA). Last view is a DetailViewController, on which detailinformation is listed for that particular name clicked in DebtViewController. Details like, the Name, Tel and Email. (Maybe a picture when i get the hang of it)

So concretely, the thing is i’ve been struggling with this for quite a few days and want to know what the best route is i should take. Is the XML i’m currently using any good for the task i want to achieve ? should i group the departments together in XML before parsing in xcode ? or can that be done afterwards just as well ? If so, pls suggest some pointers.

  • 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-06-11T07:17:18+00:00Added an answer on June 11, 2026 at 7:17 am

    You’re on the right track– based on what you’re trying to do, I would recommend formatting the xml file something like this:

    <?xml version="1.0" encoding="UTF-8"?>
    
    <!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
    
    <plist version="1.0">
    
    <dict>
    
       <key>DeptA</key>
    
             <array>
    
                <dict>
    
                   <key>Name</key>
    
                   <string>NameA</string>
    
                   <key>tel</key>
    
                   <string>0000-111111</string>
    
                   <key>email</key>
    
                   <string>namea@abc.com</string>
    
                </dict>
    
             </array>
    
       <key>DeptB</key>
    
             <array>
    
                <dict>
    
                   <key>Name</key>
    
                   <string>NameB1</string>
    
                   <key>tel</key>
    
                   <string>0000-222222</string>
    
                   <key>email</key>
    
                   <string>nameb1@abc.com</string>
    
                </dict>
    
                <dict>
    
                   <key>Name</key>
    
                   <string>NameB2</string>
    
                   <key>tel</key>
    
                   <string>0000-222223</string>
    
                   <key>email</key>
    
                   <string>nameb2@abc.com</string>
    
                </dict>
    
             </array>
    
    </dict>
    

    It’s a bit more complex than what you’ve got so far, but this allows you to read the contents of the file directly into an NSDictionary object by doing something like this:

    NSDictionary * departmentDictionary = [[NSDictionary alloc] initWithContentsOfFile:"/path/to/xml/file.xml"];
    

    Once you’ve done that, you can get a list of strings representing the department names by doing this:

    NSArray * departmentList = [departmentDictionary allKeys];
    

    And this line will get you a list of all the employees in DeptB:

    NSArray * deptBEmployees = [departmentDictionary objectForKey:@"DeptB"];
    

    The list of employees is returned in the form of an array of NSDictionary objects, each of which has values stored for the keys @”Name”, @”tel”, and @”email.”

    As you can see, it does get more than a little complicated, but trust me– once you get the hang of it, it becomes really easy to store and read really complex xml data. MacOS even has a Property List Editor that provides a nice interface for creating xml files of this type that can be read by XCode.

    I recommend this link– it was really helpful for me when I was learning to do this type of thing:
    https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/PropertyLists/Introduction/Introduction.html#//apple_ref/doc/uid/10000048-CJBGDEGD

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

Sidebar

Related Questions

I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I'm trying to create an if statement in PHP that prevents a single post
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i

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.