Trees
Using tree data structures is an excellent way to represent XML data. They allow you to create search paths through data so that you can find just the data you’re looking for, as long as you can comfortably fit the data into memory. You can retrieve all elements, search for a success value, and so forth. Trees convert text-based XML back into a multidimensional structure.
To bridge the gap between NSXMLParser and tree-based parse results, you can use an NSXMLParser-based helper class to return more standard tree-based data. This requires a simple tree node like the kind shown here:
@interface TreeNode : NSObject @property (nonatomic, weak) TreeNode *parent; @property (nonatomic, strong) NSMutableArray *children; ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access