I'm having problems including TBXML in my project.
The guide tells me to include four files,
TBXML.h,TBXML.m,NSDataAdditions.h, andNSDataAdditions.m, but the latter two are nowhere to be found in the Github repo.I tried running the sample project TBXML-Books in the hopes of copying how TBXML was imported into the project, but it doesn't build successfully in Xcode 5 either. It can't find
libTBXML-iOS.a.
Anybody help? Thanks in advance.
Including TBXML into your project
Get
TBXML.handTBXML.mfrom the Github repo and add them into your project. Those two are the only files you need.In your project's Target > Build Phases, add the compiler flag
-fno-objc-arctoTBXML.m.Loading an XML document
You can alloc-init with the other init instance methods, or do it class-method style (I didn't include the deprecated methods):
Sample XML structure
Extracting elements
Extracting attributes
Extracting element text
Traversing unknown elements/attributes
If I wanted to print out the text inside every
<text>element inside every<entry>, this is what I'll do:I haven't personally tried out traversing the attributes but I assume you can do something like
entryElement->firstAttribute, as shown in the old guide. You can also just look atTBXML.hfor how to go about it.