No trouble reading and loading, but I’m not sure about the syntax to grab a string from a particular location.
For example, with this XML…
<stories>
<story ID="01" name="Story 1">
<scenes>
<scene ID="01" name="Scene 1">
<pages>
<page ID="01">
<charName>
n010101
</charName>
<charTalk>
s010101
</charTalk>
</page>
</pages>
</scene>
</scenes>
</story>
</stories>
How would I say…
“from charName in page with ID 01 in pages in scene with ID 01 in scenes in story with ID 01 in stories”
As a path, it would be something like:
stories > story 01 > scenes > scene 01 > pages > page 01 > charName
I’ve looked at other projects that implement TBXML, but I can’t find what I’m looking for.
(I’m also really bad at looking through others’ source code, so I’ve probably come across it more than once.)
My loadStories method on Pastebin
Edit: I wonder… Which is faster, TBXML or a plist, and which is easier to code for?
They’re both loaded fully into memory, so it comes down to line count, readability, and parse time.
…
Still waiting on an answer. I don’t mind switching to NSXMLParser if someone can throw a good (useful) tutorial at me, but TBXML is much lighter, even if it does have a slightly larger footprint with huge files.
How much does it take for TBXML to become heavy, anyway?
XML has a ridiculous amount of overhead, which can get horribly inefficient in no time at all.
Property lists are easy enough to deal with, and it’s not hard to convert the contents to raw data.
NSJSON is not the absolute fastest, but it supports ARC and is much simpler to implement.
Yes, I know I didn’t actually solve the problem. This answer is for an easier, significantly better solution.