1

I have an NSXMLNode containing a series of child node and I would like to show the attribute of those child nodes in an NSTableView using NSArrayController and bindings.

I'm new to NSArrayControllers and bindings so I decided to start by populating the table with just the children of the node. It is very similar to Apple's example "XMLBrowser" although I can manage to get mine working.

My view controller has a property holding the NSXMLNode which is populated in the initWithNibName method. From here the steps I followed are:

  1. Add an NSArrayController to the xib file

  2. Set its class name to NSXMLNode and add "name" to the keys

  3. Bind it to the file owner (the ViewController) and add ".children" to the Model-Key-Path

  4. I bind my table column to the Array Controller.

  5. Set the Controller Key to "arrangedObjects" and the Model-Key-Path to "name"

I checked through breakpoints and NSLog that my NSXMLNode has meaningful children but despite that the TableView doesn't get populated.

Do you see any flaw with my steps? Is there anything I'm missing?

Also how do you debug these apps? There is very little code to place breakpoints and NSLogs, how can I know what's going on?

Andrea
  • 11,801
  • 17
  • 65
  • 72
Jacopo
  • 1,031
  • 2
  • 12
  • 25
  • What is the name of the property holding the NSXMLNode? The model key path of the content binding of the array controller should include that, but you don't say that. You say ".children", which isn't valid because of the leading period. – Ken Thomases Apr 07 '12 at 09:45
  • I do prepend the name of the property to ".children". Somehow I left it behind when typing the message. – Jacopo Apr 07 '12 at 21:09

0 Answers0